Package com.linecorp.armeria.server
Interface RoutingContext
public interface RoutingContext
Holds the parameters which are required to find a service available to handle the request.
-
Method Summary
Modifier and Type Method Description List<MediaType>
acceptTypes()
Returns a list ofMediaType
s that are specified inHttpHeaderNames.ACCEPT
in the order of client-side preferences.MediaType
contentType()
ReturnsMediaType
specified by 'Content-Type' header of the request.HttpStatusException
deferredStatusException()
Returns a deferredHttpStatusException
which was previously set viadeferStatusException(HttpStatusException)
.void
deferStatusException(HttpStatusException cause)
Defers throwing anHttpStatusException
until reaching the end of the service list.RequestHeaders
headers()
Returns theRequestHeaders
retrieved from the request.String
hostname()
Returns the virtual host name of the request.boolean
isCorsPreflight()
Returnstrue
if this context is for a CORS preflight request.HttpMethod
method()
ReturnsHttpMethod
of the request.default RoutingContext
overridePath(String path)
Returns a wrappedRoutingContext
which holds the specifiedpath
.QueryParams
params()
Returns the query parameters retrieved from the request path.String
path()
Returns the absolute path retrieved from the request, as defined in RFC3986.String
query()
Returns the query retrieved from the request, as defined in RFC3986.default boolean
requiresMatchingHeadersPredicates()
Returnstrue
if this context requires matching the predicates for HTTP headers.default boolean
requiresMatchingParamsPredicates()
Returnstrue
if this context requires matching the predicates for query parameters.VirtualHost
virtualHost()
Returns theVirtualHost
instance which belongs to thisRoutingContext
.
-
Method Details
-
virtualHost
VirtualHost virtualHost()Returns theVirtualHost
instance which belongs to thisRoutingContext
. -
hostname
String hostname()Returns the virtual host name of the request. -
method
HttpMethod method()ReturnsHttpMethod
of the request. -
path
String path()Returns the absolute path retrieved from the request, as defined in RFC3986. -
query
Returns the query retrieved from the request, as defined in RFC3986. -
params
QueryParams params()Returns the query parameters retrieved from the request path. -
contentType
ReturnsMediaType
specified by 'Content-Type' header of the request. -
acceptTypes
Returns a list ofMediaType
s that are specified inHttpHeaderNames.ACCEPT
in the order of client-side preferences. If the client does not send the header, this will contain onlyMediaType.ANY_TYPE
. -
headers
RequestHeaders headers()Returns theRequestHeaders
retrieved from the request. -
deferStatusException
Defers throwing anHttpStatusException
until reaching the end of the service list. -
deferredStatusException
Returns a deferredHttpStatusException
which was previously set viadeferStatusException(HttpStatusException)
. -
overridePath
Returns a wrappedRoutingContext
which holds the specifiedpath
. It is usually used to find anHttpService
with a prefix-stripped path. -
isCorsPreflight
boolean isCorsPreflight()Returnstrue
if this context is for a CORS preflight request.- See Also:
ArmeriaHttpUtil.isCorsPreflightRequest(HttpRequest)
-
requiresMatchingParamsPredicates
default boolean requiresMatchingParamsPredicates()Returnstrue
if this context requires matching the predicates for query parameters.- See Also:
RouteBuilder.matchesParams(Iterable)
-
requiresMatchingHeadersPredicates
default boolean requiresMatchingHeadersPredicates()Returnstrue
if this context requires matching the predicates for HTTP headers.- See Also:
RouteBuilder.matchesHeaders(Iterable)
-