Interface WebRoute<A extends ExchangeContext>
- Type Parameters:
A
- the type of the exchange context
- All Superinterfaces:
AcceptAware
,ContentAware
,InterceptableRoute<A,
,WebExchange<A>> MethodAware
,PathAware
,Route<A,
WebExchange<A>>
- All Known Subinterfaces:
WebSocketRoute<A>
A web route specifies criteria used to determine the web exchange handler to execute to handle a request.
It basically supports the following criteria:
- the path to the resource which can be parameterized as defined by
URIBuilder
. - the HTTP method used to access the resource
- the media range defining the content types accepted by the resource as defined by RFC 7231 Section 5.3.2.
- the content type of the resource
- the language tag of the resource
The path to the resource can be either static or dynamic if a parameterized path is specified as defined by URIBuilder
. When defined with a parameterized path, a
router can extract path parameters from the URIMatcher
that matches the request. For instance, path /books/{id}
defines path parameter id
and
matches paths: /books/1
, /books/2
...
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns the media range defining the content types accepted by the resource served by the route as defined by RFC 7231 Section 5.3.2.Returns the language of the resource served by the route.Returns the HTTP method accepted by the resource served by the route.getPath()
Returns the static normalized absolute path to the resource served by the route.Returns the URI pattern that matches all the paths to the resource served by the route.Returns the media type of the resource served by the route.Methods inherited from interface io.inverno.mod.web.server.spi.InterceptableRoute
getInterceptors, setInterceptors
Methods inherited from interface io.inverno.mod.web.server.spi.Route
disable, enable, getHandler, isDisabled, remove
-
Method Details
-
getPath
String getPath()Returns the static normalized absolute path to the resource served by the route.
This criteria should exactly match the absolute path of the request.
-
getPathPattern
URIPattern getPathPattern()Returns the URI pattern that matches all the paths to the resource served by the route.
This criteria should match the absolute path of the request.
- Specified by:
getPathPattern
in interfacePathAware
- Returns:
- a URI pattern or null
-
getMethod
Method getMethod()Returns the HTTP method accepted by the resource served by the route.
This criteria should match the request HTTP method.
- Specified by:
getMethod
in interfaceMethodAware
- Returns:
- a HTTP method or null
-
getConsume
String getConsume()Returns the media range defining the content types accepted by the resource served by the route as defined by RFC 7231 Section 5.3.2.
This criteria should match the request
content-type
header field.- Specified by:
getConsume
in interfaceContentAware
- Returns:
- a media range or null
-
getProduce
String getProduce()Returns the media type of the resource served by the route.
This criteria should match the request
accept
header field.- Specified by:
getProduce
in interfaceAcceptAware
- Returns:
- a media type or null
-
getLanguage
String getLanguage()Returns the language of the resource served by the route.
This criteria should match the request
accept-language
header field.- Specified by:
getLanguage
in interfaceAcceptAware
- Returns:
- a language tag or null
-