Class AbstractReactorHttpExchangeAdapter
java.lang.Object
org.springframework.web.service.invoker.AbstractReactorHttpExchangeAdapter
- All Implemented Interfaces:
HttpExchangeAdapter
,ReactorHttpExchangeAdapter
- Direct Known Subclasses:
WebClientAdapter
public abstract class AbstractReactorHttpExchangeAdapter
extends Object
implements ReactorHttpExchangeAdapter
Convenient base class for a
ReactorHttpExchangeAdapter
implementation
adapting to the synchronous HttpExchangeAdapter
contract.- Since:
- 6.1
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ModifierConstructorDescriptionprotected
Protected constructor, for subclasses. -
Method Summary
Modifier and TypeMethodDescriptionvoid
exchange
(HttpRequestValues requestValues) Perform the given request, and release the response content, if any.exchangeForBodilessEntity
(HttpRequestValues requestValues) Variant ofHttpExchangeAdapter.exchange(HttpRequestValues)
with additional access to the response status and headers.<T> T
exchangeForBody
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Perform the given request and decode the response content to the given type.<T> ResponseEntity<T>
exchangeForEntity
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Variant ofHttpExchangeAdapter.exchangeForBody(HttpRequestValues, ParameterizedTypeReference)
with additional access to the response status and headers.exchangeForHeaders
(HttpRequestValues requestValues) Perform the given request, release the response content, and return the response headers.Return the configured time to block for the response from an HTTP service method with a synchronous (blocking) method signature.Return the configuredReactiveAdapterRegistry
.void
setBlockTimeout
(@Nullable Duration blockTimeout) Configure how long to block for the response of an HTTP service method as described ingetBlockTimeout()
.void
setReactiveAdapterRegistry
(ReactiveAdapterRegistry reactiveAdapterRegistry) Configure theReactiveAdapterRegistry
to use.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.service.invoker.HttpExchangeAdapter
supportsRequestAttributes
Methods inherited from interface org.springframework.web.service.invoker.ReactorHttpExchangeAdapter
exchangeForBodilessEntityMono, exchangeForBodyFlux, exchangeForBodyMono, exchangeForEntityFlux, exchangeForEntityMono, exchangeForHeadersMono, exchangeForMono
-
Constructor Details
-
AbstractReactorHttpExchangeAdapter
protected AbstractReactorHttpExchangeAdapter()Protected constructor, for subclasses.
-
-
Method Details
-
setReactiveAdapterRegistry
Configure theReactiveAdapterRegistry
to use.By default, this is
ReactiveAdapterRegistry.getSharedInstance()
. -
getReactiveAdapterRegistry
Description copied from interface:ReactorHttpExchangeAdapter
Return the configuredReactiveAdapterRegistry
.- Specified by:
getReactiveAdapterRegistry
in interfaceReactorHttpExchangeAdapter
-
setBlockTimeout
Configure how long to block for the response of an HTTP service method as described ingetBlockTimeout()
. -
getBlockTimeout
Description copied from interface:ReactorHttpExchangeAdapter
Return the configured time to block for the response from an HTTP service method with a synchronous (blocking) method signature.By default, not set in which case the behavior depends on connection and request timeout settings of the underlying HTTP client. We recommend configuring timeout values directly on the underlying HTTP client, which provides more control over such settings.
- Specified by:
getBlockTimeout
in interfaceReactorHttpExchangeAdapter
-
exchange
Description copied from interface:HttpExchangeAdapter
Perform the given request, and release the response content, if any.- Specified by:
exchange
in interfaceHttpExchangeAdapter
- Parameters:
requestValues
- the request to perform
-
exchangeForHeaders
Description copied from interface:HttpExchangeAdapter
Perform the given request, release the response content, and return the response headers.- Specified by:
exchangeForHeaders
in interfaceHttpExchangeAdapter
- Parameters:
requestValues
- the request to perform- Returns:
- the response headers
-
exchangeForBody
public <T> T exchangeForBody(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Description copied from interface:HttpExchangeAdapter
Perform the given request and decode the response content to the given type.- Specified by:
exchangeForBody
in interfaceHttpExchangeAdapter
- Type Parameters:
T
- the type the response is decoded to- Parameters:
requestValues
- the request to performbodyType
- the target type to decode to- Returns:
- the decoded response body.
-
exchangeForBodilessEntity
Description copied from interface:HttpExchangeAdapter
Variant ofHttpExchangeAdapter.exchange(HttpRequestValues)
with additional access to the response status and headers.- Specified by:
exchangeForBodilessEntity
in interfaceHttpExchangeAdapter
- Returns:
- the response entity with status and headers.
-
exchangeForEntity
public <T> ResponseEntity<T> exchangeForEntity(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Description copied from interface:HttpExchangeAdapter
Variant ofHttpExchangeAdapter.exchangeForBody(HttpRequestValues, ParameterizedTypeReference)
with additional access to the response status and headers.- Specified by:
exchangeForEntity
in interfaceHttpExchangeAdapter
- Returns:
- the response entity with status, headers, and body.
-