Interface WebSocketRouteManager<A extends ExchangeContext,B extends WebRouter<A>>
- Type Parameters:
A
- the exchange context typeB
- the Web router type
- All Superinterfaces:
BaseWebRouteManager<A,
WebExchange<A>, WebSocketRoute<A>, B>
Manages WebSocket routes in the Web server.
A WebSocket route manager is obtained from WebServer.webSocketRoute()
, it allows to specify the criteria a Web exchange must match to be handled by the WebSocket exchange handler defined in
handler(WebSocketExchangeHandler)
When setting the exchange handler, interceptors defined in an intercepted Web server are applied to the route when criteria are matching.
It is possible to specify multiple values for any given criteria resulting in multiple WebSocket routes being created in the Web router. For instance, the following code will result in the creation of two routes:
webServer
.route()
.path("/path/to/resource")
.subProtocol("json")
.subProtocol("xml")
.handler(exchange -> {...})
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Method Summary
Modifier and TypeMethodDescriptionhandler
(WebSocketExchangeHandler<? super A, Web2SocketExchange<A>> handler) Specifies the WebSocket exchange handler used to process Web exchanges matching the criteria specified in the route manager and returns the originating Web router.Specifies the language tag as defined by RFC 7231 Section 5.3.5 that must be accepted by a Web exchange to be processed by the route.default WebSocketRouteManager
<A, B> Specifies the absolute path that must be matched by a Web exchange to be processed by the route.Specifies the absolute path that must be matched with or without trailing slash by a Web exchange to be processed by the route.subprotocol
(String subprotocol) Specifies the WebSocket subProtocol that must be matched by a Web exchange to be processed by the route.Methods inherited from interface io.inverno.mod.web.server.BaseWebRouteManager
disable, enable, findRoutes, remove
-
Method Details
-
path
Specifies the absolute path that must be matched by a Web exchange to be processed by the route.
The specified path can be specified as a parameterized path and include path pattern like
?
,*
,**
as defined byURIBuilder
. Note that this path is only meant to filter routes and as a result path parameters have no use.- Parameters:
path
- a path- Returns:
- the route manager
- Throws:
IllegalArgumentException
- if the specified path is not absolute
-
path
Specifies the absolute path that must be matched with or without trailing slash by a Web exchange to be processed by the route.
The specified path can be specified as a parameterized path and include path pattern like
?
,*
,**
as defined byURIBuilder
. Note that this path is only meant to filter routes and as a result path parameters have no use.- Parameters:
path
- a pathmatchTrailingSlash
- true to match path with or without trailing slash, false otherwise- Returns:
- the route manager
- Throws:
IllegalArgumentException
- if the specified path is not absolute
-
language
Specifies the language tag as defined by RFC 7231 Section 5.3.5 that must be accepted by a Web exchange to be processed by the route.
- Parameters:
languageTag
- a language tag (e.g.fr-FR
)- Returns:
- the route manager
-
subprotocol
Specifies the WebSocket subProtocol that must be matched by a Web exchange to be processed by the route.
- Parameters:
subprotocol
- a subProtocol- Returns:
- the route manager
-
handler
Specifies the WebSocket exchange handler used to process Web exchanges matching the criteria specified in the route manager and returns the originating Web router.
The WebSocket route manager is usually obtained from
WebServer.webSocketRoute()
in which case the resulting Web router is then aWebServer
instance.Any Web route interceptor defined in an intercepted Web server and matching the criteria specified in the route manager is applied to the resulting WebSocket routes.
- Parameters:
handler
- a WebSocket exchange handler- Returns:
- the originating Web router
-