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
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceWebExchange.Configurer<A extends ExchangeContext>A Web exchange configurer. -
Method Summary
Modifier and TypeMethodDescriptionfailOnErrorStatus(boolean failOnErrorStatus) Specifies whether anHttpExceptionshould 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
HttpExceptionshould 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:BaseExchangeReturns the request part of the exchange.
- Specified by:
requestin interfaceBaseExchange<A extends ExchangeContext,Request, Mono<? extends Response>> - Returns:
- the request part
-
response
Mono<WebResponse> response()Description copied from interface:ExchangeReturns the response part of the exchange.
The connection is created and the request sent when the returned publisher is subscribed.
- Specified by:
responsein interfaceBaseExchange<A extends ExchangeContext,Request, Mono<? extends Response>> - Specified by:
responsein interfaceExchange<A extends ExchangeContext>- Returns:
- the response part
-
webSocket
Description copied from interface:ExchangeReturns a WebSocket exchange publisher.
The WebSocket connection and the corresponding
WebSocketExchangeare created when the returned publisher is subscribed.- Specified by:
webSocketin interfaceExchange<A extends ExchangeContext>- Returns:
- a WebSocket exchange mono
-
webSocket
Description copied from interface:ExchangeReturns a WebSocket exchange publisher requesting the specified subprotocol.
The WebSocket connection and the corresponding
WebSocketExchangeare created when the returned publisher is subscribed.- Specified by:
webSocketin interfaceExchange<A extends ExchangeContext>- Parameters:
subProtocol- the subprotocol requested to the server by the client.- Returns:
- a WebSocket exchange mono
-