com.holonplatform.http.rest

## Interface ResponseEntity<T>

- Type Parameters:
    `T` - Response entity expected type
  All Superinterfaces:
    HttpHeaders, HttpMessage<T>, HttpResponse<T>, Message<T,List<String>>, MessageHeaders<List<String>>

      public interface ResponseEntity<T>
      extends HttpResponse<T>

  `HttpResponse` extension that adds HTTP entity handling, dealing with HTTP response body processing and conversion into a supported Java type, besides the one expected as declared response type.
  Since:
    5.0.0

- - ### Nested Class Summary

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

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

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `<E> Optional<E>` | `as(Class<E> entityType)` Read the message entity as an instance of specified type.
    `<E> Optional<E>` | `as(ResponseType<E> entityType)` Read the message entity as an instance of specified type, using a `ResponseType` representation to allow generic types support.
    `void` | `close()` If supported by the underlying implementation, close the message entity input stream (if available and open) as well as releases any other resources associated with the response.

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

      `builder, getStatus, getStatusCode`

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

      `getProtocol`

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

      `getPayload, getPayloadType`

    - ### 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, getHeaders`

- - ### Method Detail

    - #### as

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

      Read the message entity as an instance of specified type.
      Type Parameters:
        `E` - Entity instance type
      Parameters:
        `entityType` - Entity type (not null)
      Returns:
        the message entity; for a zero-length response entities an empty Optional is returned
      Throws:
        `HttpEntityProcessingException` - If the content of the message cannot be mapped to an entity of the requested type

    - #### as

          <E> Optional<E> as(ResponseType<E> entityType)

      Read the message entity as an instance of specified type, using a `ResponseType` representation to allow generic types support.
      Type Parameters:
        `E` - Entity instance type
      Parameters:
        `entityType` - Entity response type (not null)
      Returns:
        the message entity; for a zero-length response entities an empty Optional is returned
      Throws:
        `HttpEntityProcessingException` - If the content of the message cannot be mapped to an entity of the requested type

    - #### close

          void close()

      If supported by the underlying implementation, close the message entity input stream (if available and open) as well as releases any other resources associated with the response.
      Throws:
        `HttpEntityProcessingException` - If there is an error closing the response

Copyright © 2017 The Holon Platform. All rights reserved.