Interface WebExchange<A extends ExchangeContext>
- Type Parameters:
A
- the type of the exchange context
- All Superinterfaces:
BaseExchange<A,
,Request, Response> Exchange<A>
An exchange that extends the HTTP server Exchange
with features for the Web.
It supports request body decoding based on the request content type as well as response body encoding based on the response content type.
It also gives access to path parameters when processed in a route defined with a URIPattern
.
It also exposes a context which can be used to propagate information in a chain of exchange handlers. The WebRouter
uses WebServerControllerConfigurer.createContext()
to create the
context attached to the Web exchange.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Methods inherited from interface io.inverno.mod.http.base.BaseExchange
context, getCancelCause, getProtocol, reset, reset
-
Method Details
-
request
WebRequest request()Description copied from interface:BaseExchange
Returns the request part of the exchange.
- Specified by:
request
in interfaceBaseExchange<A extends ExchangeContext,
Request, Response> - Returns:
- the request part
-
response
WebResponse response()Description copied from interface:BaseExchange
Returns the response part of the exchange.
- Specified by:
response
in interfaceBaseExchange<A extends ExchangeContext,
Request, Response> - Returns:
- the response part
-
webSocket
Description copied from interface:Exchange
Upgrades the exchange to a WebSocket exchange.
If the exchange cannot upgrade to the WebSocket protocol, an empty optional shall be returned. For instance, if the state of the exchange prevents the upgrade (e.g. error exchange) or if the underlying HTTP protocol does not support the upgrade operation. Currently only HTTP/1.1 can upgrade to the WebSocket protocol.
- Specified by:
webSocket
in interfaceExchange<A extends ExchangeContext>
- Parameters:
subProtocols
- a list of supported subprotocols negotiated during the handshake- Returns:
- an optional returning the WebSocket or an empty optional if the upgrade is not possible
-