Package org.springframework.web.service.invoker

# Class AbstractReactorHttpExchangeAdapter

java.lang.Object
org.springframework.web.service.invoker.AbstractReactorHttpExchangeAdapter

All Implemented Interfaces:
  `HttpClientAdapter`, `HttpExchangeAdapter`, `ReactorHttpExchangeAdapter`

public abstract class AbstractReactorHttpExchangeAdapter extends Object implements ReactorHttpExchangeAdapter, HttpClientAdapter
Convenient base class for a `ReactorHttpExchangeAdapter` implementation adapting to the synchronous `HttpExchangeAdapter` contract.

Since:
  6.1
Author:
  Rossen Stoyanchev

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractReactorHttpExchangeAdapter()`
Protected constructor, for subclasses.

## Method Summary

Modifier and Type
Method
Description
`void`
`exchange(HttpRequestValues requestValues)`
Perform the given request, and release the response content, if any.
`ResponseEntity<Void>`
`exchangeForBodilessEntity(HttpRequestValues requestValues)`
Variant of `HttpExchangeAdapter.exchange(HttpRequestValues)` with additional access to the response status and headers.
`<T> T`
`exchangeForBody(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)`
Perform the given request and decode the response content to the given type.
`<T> ResponseEntity<T>`
`exchangeForEntity(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)`
Variant of `HttpExchangeAdapter.exchangeForBody(HttpRequestValues, ParameterizedTypeReference)` with additional access to the response status and headers.
`HttpHeaders`
`exchangeForHeaders(HttpRequestValues requestValues)`
Perform the given request, release the response content, and return the response headers.
`Duration`
`getBlockTimeout()`
Return the configured time to block for the response from an HTTP service method with a synchronous (blocking) method signature.
`org.springframework.core.ReactiveAdapterRegistry`
`getReactiveAdapterRegistry()`
Return the configured `ReactiveAdapterRegistry`.
`reactor.core.publisher.Mono<ResponseEntity<Void>>`
`requestToBodilessEntity(HttpRequestValues requestValues)`
Variant of `HttpClientAdapter.requestToVoid(HttpRequestValues)` with additional access to the response status and headers.
`<T> reactor.core.publisher.Mono<T>`
`requestToBody(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)`
Perform the given request and decode the response content to the given type.
`<T> reactor.core.publisher.Flux<T>`
`requestToBodyFlux(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)`
Perform the given request and decode the response content to a stream with elements of the given type.
`<T> reactor.core.publisher.Mono<ResponseEntity<T>>`
`requestToEntity(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)`
Variant of `HttpClientAdapter.requestToBody(HttpRequestValues, ParameterizedTypeReference)` with additional access to the response status and headers.
`<T> reactor.core.publisher.Mono<ResponseEntity<reactor.core.publisher.Flux<T>>>`
`requestToEntityFlux(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)`
Variant of `HttpClientAdapter.requestToBodyFlux(HttpRequestValues, ParameterizedTypeReference)` with additional access to the response status and headers.
`reactor.core.publisher.Mono<HttpHeaders>`
`requestToHeaders(HttpRequestValues requestValues)`
Perform the given request, release the response content, and return the response headers.
`reactor.core.publisher.Mono<Void>`
`requestToVoid(HttpRequestValues requestValues)`
Perform the given request, and release the response content, if any.
`void`
`setBlockTimeout(Duration blockTimeout)`
Configure how long to block for the response of an HTTP service method as described in `getBlockTimeout()`.
`void`
`setReactiveAdapterRegistry(org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry)`
Configure the `ReactiveAdapterRegistry` 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.HttpClientAdapter

`asReactorExchangeAdapter`

### 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

public void setReactiveAdapterRegistry(org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry)
Configure the `ReactiveAdapterRegistry` to use.

By default, this is `ReactiveAdapterRegistry.getSharedInstance()`.

### getReactiveAdapterRegistry

public org.springframework.core.ReactiveAdapterRegistry getReactiveAdapterRegistry()
Description copied from interface: `ReactorHttpExchangeAdapter`
Return the configured `ReactiveAdapterRegistry`.

Specified by:
  `getReactiveAdapterRegistry` in interface `ReactorHttpExchangeAdapter`

### setBlockTimeout

public void setBlockTimeout(@Nullable Duration blockTimeout)
Configure how long to block for the response of an HTTP service method as described in `getBlockTimeout()`.

### getBlockTimeout

@Nullable public Duration 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 interface `ReactorHttpExchangeAdapter`

### exchange

public void exchange(HttpRequestValues requestValues)
Description copied from interface: `HttpExchangeAdapter`
Perform the given request, and release the response content, if any.

Specified by:
  `exchange` in interface `HttpExchangeAdapter`
Parameters:
  `requestValues` - the request to perform

### exchangeForHeaders

public HttpHeaders exchangeForHeaders(HttpRequestValues requestValues)
Description copied from interface: `HttpExchangeAdapter`
Perform the given request, release the response content, and return the response headers.

Specified by:
  `exchangeForHeaders` in interface `HttpExchangeAdapter`
Parameters:
  `requestValues` - the request to perform
Returns:
  the response headers

### exchangeForBody

public <T> T exchangeForBody(HttpRequestValues requestValues, org.springframework.core.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 interface `HttpExchangeAdapter`
Type Parameters:
  `T` - the type the response is decoded to
Parameters:
  `requestValues` - the request to perform
  `bodyType` - the target type to decode to
Returns:
  the decoded response body.

### exchangeForBodilessEntity

public ResponseEntity<Void> exchangeForBodilessEntity(HttpRequestValues requestValues)
Description copied from interface: `HttpExchangeAdapter`
Variant of `HttpExchangeAdapter.exchange(HttpRequestValues)` with additional access to the response status and headers.

Specified by:
  `exchangeForBodilessEntity` in interface `HttpExchangeAdapter`
Returns:
  the response entity with status and headers.

### exchangeForEntity

public <T> ResponseEntity<T> exchangeForEntity(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
Description copied from interface: `HttpExchangeAdapter`
Variant of `HttpExchangeAdapter.exchangeForBody(HttpRequestValues, ParameterizedTypeReference)` with additional access to the response status and headers.

Specified by:
  `exchangeForEntity` in interface `HttpExchangeAdapter`
Returns:
  the response entity with status, headers, and body.

### requestToVoid

public reactor.core.publisher.Mono<Void> requestToVoid(HttpRequestValues requestValues)
Description copied from interface: `HttpClientAdapter`
Perform the given request, and release the response content, if any.

Specified by:
  `requestToVoid` in interface `HttpClientAdapter`
Parameters:
  `requestValues` - the request to perform
Returns:
  `Mono` that completes when the request is fully executed and the response content is released.

### requestToHeaders

public reactor.core.publisher.Mono<HttpHeaders> requestToHeaders(HttpRequestValues requestValues)
Description copied from interface: `HttpClientAdapter`
Perform the given request, release the response content, and return the response headers.

Specified by:
  `requestToHeaders` in interface `HttpClientAdapter`
Parameters:
  `requestValues` - the request to perform
Returns:
  `Mono` that returns the response headers the request is fully executed and the response content released.

### requestToBody

public <T> reactor.core.publisher.Mono<T> requestToBody(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
Description copied from interface: `HttpClientAdapter`
Perform the given request and decode the response content to the given type.

Specified by:
  `requestToBody` in interface `HttpClientAdapter`
Type Parameters:
  `T` - the type the response is decoded to
Parameters:
  `requestValues` - the request to perform
  `bodyType` - the target type to decode to
Returns:
  `Mono` that returns the decoded response.

### requestToBodyFlux

public <T> reactor.core.publisher.Flux<T> requestToBodyFlux(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
Description copied from interface: `HttpClientAdapter`
Perform the given request and decode the response content to a stream with elements of the given type.

Specified by:
  `requestToBodyFlux` in interface `HttpClientAdapter`
Type Parameters:
  `T` - the type the response is decoded to
Parameters:
  `requestValues` - the request to perform
  `bodyType` - the target stream element type to decode to
Returns:
  `Flux` with decoded stream elements.

### requestToBodilessEntity

public reactor.core.publisher.Mono<ResponseEntity<Void>> requestToBodilessEntity(HttpRequestValues requestValues)
Description copied from interface: `HttpClientAdapter`
Variant of `HttpClientAdapter.requestToVoid(HttpRequestValues)` with additional access to the response status and headers.

Specified by:
  `requestToBodilessEntity` in interface `HttpClientAdapter`

### requestToEntity

public <T> reactor.core.publisher.Mono<ResponseEntity<T>> requestToEntity(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
Description copied from interface: `HttpClientAdapter`
Variant of `HttpClientAdapter.requestToBody(HttpRequestValues, ParameterizedTypeReference)` with additional access to the response status and headers.

Specified by:
  `requestToEntity` in interface `HttpClientAdapter`

### requestToEntityFlux

public <T> reactor.core.publisher.Mono<ResponseEntity<reactor.core.publisher.Flux<T>>> requestToEntityFlux(HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
Description copied from interface: `HttpClientAdapter`
Variant of `HttpClientAdapter.requestToBodyFlux(HttpRequestValues, ParameterizedTypeReference)` with additional access to the response status and headers.

Specified by:
  `requestToEntityFlux` in interface `HttpClientAdapter`