com.holonplatform.reactor.spring.internal

## Class ClientResponseEntity<T>

- java.lang.Object
- - com.holonplatform.reactor.spring.internal.ClientResponseEntity<T>

- Type Parameters:
    `T` - Response entity type
  All Implemented Interfaces:
    com.holonplatform.core.messaging.Message<T,List<String>>, com.holonplatform.core.messaging.MessageHeaders<List<String>>, com.holonplatform.http.HttpHeaders, com.holonplatform.http.HttpMessage<T>, com.holonplatform.http.HttpResponse<T>, com.holonplatform.http.rest.ResponseEntity<T>, ReactiveResponseEntity<T>

      public class ClientResponseEntity<T>
      extends Object
      implements ReactiveResponseEntity<T>

  Spring `ResponseEntity` implementation using a `ClientResponse`.
  Since:
    5.2.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.http.HttpResponse

      `com.holonplatform.http.HttpResponse.Builder<T>`

  - ### Field Summary

    - ### Fields inherited from interface com.holonplatform.http.HttpHeaders

      `ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ACCEPT_RANGES, AGE, ALLOW, AUTHORIZATION, CACHE_CONTROL, CONNECTION, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_RANGE, CONTENT_TYPE, COOKIE, DATE, ETAG, EXPECT, EXPIRES, FROM, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_RANGE, IF_UNMODIFIED_SINCE, LAST_MODIFIED, LINK, LOCATION, MAX_FORWARDS, ORIGIN, PRAGMA, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, RANGE, REFERER, RETRY_AFTER, SCHEME_BASIC, SCHEME_BEARER, SCHEME_DIGEST, SERVER, SET_COOKIE, TRAILER, TRANSFER_ENCODING, UPGRADE, USER_AGENT, VARY, VIA, WARNING, WWW_AUTHENTICATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientResponseEntity(org.springframework.web.reactive.function.client.ClientResponse response, com.holonplatform.http.rest.ResponseType<T> type)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<E> Optional<E>` | `as(Class<E> entityType)`
    `<E> Optional<E>` | `as(com.holonplatform.http.rest.ResponseType<E> entityType)`
    `<E> reactor.core.publisher.Flux<E>` | `asFlux(Class<E> entityType)` Read the message entity as a `Flux` of the specified type.
    `reactor.core.publisher.Mono<InputStream>` | `asInputStream()` Read the message entity as a raw `InputStream`.
    `reactor.core.publisher.Mono<T>` | `asMono()` Read the message entity as a `Mono`.
    `<E> reactor.core.publisher.Mono<E>` | `asMono(Class<E> entityType)` Read the message entity as a `Mono` of the specified type.
    `<E> reactor.core.publisher.Mono<E>` | `asMono(com.holonplatform.http.rest.ResponseType<E> entityType)` Read the message entity as a `Mono` of the specified type., using a `ResponseType` representation to allow generic types support.
    `void` | `close()`
    `Map<String,List<String>>` | `getHeaders()`
    `Optional<T>` | `getPayload()`
    `Class<? extends T>` | `getPayloadType()`
    `int` | `getStatusCode()`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.holonplatform.http.HttpResponse

      `builder, builder, getStatus`

    - ### Methods inherited from interface com.holonplatform.http.HttpMessage

      `getProtocol`

    - ### Methods inherited from interface com.holonplatform.http.HttpHeaders

      `getAuthorizationBasicCredentials, getAuthorizationBearer, getContentLength, getDate, getHeaderValue, getLocale, getLocales, getLocation`

    - ### Methods inherited from interface com.holonplatform.core.messaging.MessageHeaders

      `getHeader`

- - ### Constructor Detail

    - #### ClientResponseEntity

          public ClientResponseEntity(org.springframework.web.reactive.function.client.ClientResponse response,
                                      com.holonplatform.http.rest.ResponseType<T> type)

  - ### Method Detail

    - #### getStatusCode

          public int getStatusCode()

      Specified by:
        `getStatusCode` in interface `com.holonplatform.http.HttpResponse<T>`

    - #### getHeaders

          public Map<String,List<String>> getHeaders()

      Specified by:
        `getHeaders` in interface `com.holonplatform.core.messaging.MessageHeaders<List<String>>`

    - #### getPayloadType

          public Class<? extends T> getPayloadType()
                                            throws UnsupportedOperationException

      Specified by:
        `getPayloadType` in interface `com.holonplatform.core.messaging.Message<T,List<String>>`
      Throws:
        `UnsupportedOperationException`

    - #### asMono

          public reactor.core.publisher.Mono<T> asMono()

      Description copied from interface: `ReactiveResponseEntity`
      Read the message entity as a `Mono`.
      Specified by:
        `asMono` in interface `ReactiveResponseEntity<T>`
      Returns:
        A `Mono` containing the message entity

    - #### asMono

          public <E> reactor.core.publisher.Mono<E> asMono(Class<E> entityType)

      Description copied from interface: `ReactiveResponseEntity`
      Read the message entity as a `Mono` of the specified type.
      Specified by:
        `asMono` in interface `ReactiveResponseEntity<T>`
      Type Parameters:
        `E` - Entity instance type
      Parameters:
        `entityType` - Entity type (not null)
      Returns:
        A `Mono` containing the message entity

    - #### asMono

          public <E> reactor.core.publisher.Mono<E> asMono(com.holonplatform.http.rest.ResponseType<E> entityType)

      Description copied from interface: `ReactiveResponseEntity`
      Read the message entity as a `Mono` of the specified type., using a `ResponseType` representation to allow generic types support.
      Specified by:
        `asMono` in interface `ReactiveResponseEntity<T>`
      Type Parameters:
        `E` - Entity instance type
      Parameters:
        `entityType` - Entity response type (not null)
      Returns:
        A `Mono` containing the message entity

    - #### asFlux

          public <E> reactor.core.publisher.Flux<E> asFlux(Class<E> entityType)

      Description copied from interface: `ReactiveResponseEntity`
      Read the message entity as a `Flux` of the specified type.
      Specified by:
        `asFlux` in interface `ReactiveResponseEntity<T>`
      Type Parameters:
        `E` - Entity instance type
      Parameters:
        `entityType` - Entity type (not null)
      Returns:
        A `Flux` containing the message entity

    - #### asInputStream

          public reactor.core.publisher.Mono<InputStream> asInputStream()

      Description copied from interface: `ReactiveResponseEntity`
      Read the message entity as a raw `InputStream`.
      Specified by:
        `asInputStream` in interface `ReactiveResponseEntity<T>`
      Returns:
        A `Mono` to handle the message entity stream

    - #### getPayload

          public Optional<T> getPayload()
                                 throws UnsupportedOperationException

      Specified by:
        `getPayload` in interface `com.holonplatform.core.messaging.Message<T,List<String>>`
      Throws:
        `UnsupportedOperationException`

    - #### as

          public <E> Optional<E> as(Class<E> entityType)

      Specified by:
        `as` in interface `com.holonplatform.http.rest.ResponseEntity<T>`

    - #### as

          public <E> Optional<E> as(com.holonplatform.http.rest.ResponseType<E> entityType)

      Specified by:
        `as` in interface `com.holonplatform.http.rest.ResponseEntity<T>`

    - #### close

          public void close()

      Specified by:
        `close` in interface `com.holonplatform.http.rest.ResponseEntity<T>`

Copyright © 2019 The Holon Platform. All rights reserved.