Package com.linecorp.armeria.server
Interface Route
-
public interface Route
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description RoutingResult
apply(RoutingContext routingCtx)
Matches the specifiedRoutingContext
and extracts the path parameters from it if exists.static RouteBuilder
builder()
Returns a new builder.int
complexity()
Returns the complexity of thisRoute
.Set<MediaType>
consumes()
String
loggerName()
Returns the logger name.String
meterTag()
Set<HttpMethod>
methods()
Set<String>
paramNames()
Returns the names of the path parameters extracted by this mapping.List<String>
paths()
Returns the list of paths that thisRoute
has.RoutePathType
pathType()
Returns the type of the path which was specified when this is created.Set<MediaType>
produces()
-
-
-
Method Detail
-
builder
static RouteBuilder builder()
Returns a new builder.
-
apply
RoutingResult apply(RoutingContext routingCtx)
Matches the specifiedRoutingContext
and extracts the path parameters from it if exists.- Parameters:
routingCtx
- a context to find theService
- Returns:
- a non-empty
RoutingResult
if the path, method, contentType and acceptTypes matches the equivalent conditions inRoute
.RoutingResult.empty()
otherwise. - See Also:
RouteBuilder.methods(Iterable)
,RouteBuilder.consumes(Iterable)
,RouteBuilder.produces(Iterable)
-
paramNames
Set<String> paramNames()
Returns the names of the path parameters extracted by this mapping.
-
loggerName
String loggerName()
Returns the logger name.- Returns:
- the logger name whose components are separated by a dot (.)
-
meterTag
String meterTag()
-
pathType
RoutePathType pathType()
Returns the type of the path which was specified when this is created.
-
paths
List<String> paths()
Returns the list of paths that thisRoute
has. The paths are different according to the value ofpathType()
. If the path type has a trie path, this method will return a two-element list whose first element is the path that represents the type and the second element is the trie path.RoutePathType.EXACT
,RoutePathType.PREFIX
andRoutePathType.PARAMETERIZED
have the trie path.- EXACT:
[ "/foo", "/foo" ]
(The trie path is the same.) - PREFIX:
[ "/foo/", "/foo/*" ]
- PARAMETERIZED:
[ "/foo/:", "/foo/:" ]
(The trie path is the same.)
RoutePathType.REGEX
may have one or two paths. If theRoute
was created from a glob pattern, it will have two paths where the first one is the regular expression and the second one is the glob pattern, e.g.[ "^/(?(.+)/)?foo$", "/**/foo" ]
. If not created from a glob pattern, it will have only one path, which is the regular expression, e.g,[ "^/(?<foo>.*)$" ]
RoutePathType.REGEX_WITH_PREFIX
has two paths. The first one is the regex and the second one is the path. e.g,[ "^/(?<foo>.*)$", "/bar/" ]
- EXACT:
-
complexity
int complexity()
Returns the complexity of thisRoute
. A higher complexity indicates more expensive computation for route matching, usually due to additional number of checks.
-
methods
Set<HttpMethod> methods()
-
-