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 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 gives access to path parameters when processed in a route defined with a URIPattern
and exposes a context used to propagate contextual information throughout the processing of the
exchange.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
-
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
-