Interface WebExchange<A extends ExchangeContext>
- Type Parameters:
A
- the exchange context type
- All Superinterfaces:
BaseExchange<A,
,Request, Mono<? extends Response>> Exchange<A>
An exchange that extends HTTP client Exchange
with features for the Web.
It supports request body encoding based on the request content type as well as response body decoding based on the response content type.
It gives access to the request URI and exposes a context which used to propagate contextual information throughout the processing of the exchange.
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
WebExchange.Configurer<A extends ExchangeContext>
A Web exchange configurer. -
Method Summary
Modifier and TypeMethodDescriptionfailOnErrorStatus
(boolean failOnErrorStatus) Specifies whether anHttpException
should be raised when a client or server error response is received.request()
Returns the request part of the exchange.response()
Returns the response part of the exchange.default Mono
<Web2SocketExchange<A>> Returns a WebSocket exchange publisher.Returns a WebSocket exchange publisher requesting the specified subprotocol.Methods inherited from interface io.inverno.mod.http.base.BaseExchange
context, getCancelCause, getProtocol, reset, reset
-
Method Details
-
failOnErrorStatus
Specifies whether an
HttpException
should be raised when a client or server error response is received.When set to true, the
response()
returns a Mono that fails when the response has a client (4xx
) or server (5xx
) error status code. This is the default behaviour.It is possible to customize how the response is mapped to the error in an exchange interceptor with
InterceptedWebExchange.failOnErrorStatus(Function)
.- Parameters:
failOnErrorStatus
- true to raise an HTTP exception on client (4xx
) or server(5xx
) error, false otherwise- Returns:
- the Web exchange
-
request
WebRequest request()Description copied from interface:BaseExchange
Returns the request part of the exchange.
- Specified by:
request
in interfaceBaseExchange<A extends ExchangeContext,
Request, Mono<? extends Response>> - Returns:
- the request part
-
response
Mono<WebResponse> response()Description copied from interface:Exchange
Returns the response part of the exchange.
The connection is created and the request sent when the returned publisher is subscribed.
- Specified by:
response
in interfaceBaseExchange<A extends ExchangeContext,
Request, Mono<? extends Response>> - Specified by:
response
in interfaceExchange<A extends ExchangeContext>
- Returns:
- the response part
-
webSocket
Description copied from interface:Exchange
Returns a WebSocket exchange publisher.
The WebSocket connection and the corresponding
WebSocketExchange
are created when the returned publisher is subscribed.- Specified by:
webSocket
in interfaceExchange<A extends ExchangeContext>
- Returns:
- a WebSocket exchange mono
-
webSocket
Description copied from interface:Exchange
Returns a WebSocket exchange publisher requesting the specified subprotocol.
The WebSocket connection and the corresponding
WebSocketExchange
are created when the returned publisher is subscribed.- Specified by:
webSocket
in interfaceExchange<A extends ExchangeContext>
- Parameters:
subProtocol
- the subprotocol requested to the server by the client.- Returns:
- a WebSocket exchange mono
-