com.holonplatform.http

## Interface HttpResponse<T>

- Type Parameters:
    `T` - Payload type
  All Superinterfaces:
    HttpHeaders, HttpMessage<T>, Message<T,List<String>>, MessageHeaders<List<String>>
  All Known Subinterfaces:
    ResponseEntity<T>

      public interface HttpResponse<T>
      extends HttpMessage<T>

  Represents a generic HTTP response
  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `HttpResponse.Builder<T>` Default HttpResponse builder.

  - ### 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 Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> HttpResponse.Builder<T>` | `builder(HttpStatus status, Class<? extends T> payloadType)` Get a builder to create a default `HttpResponse` instance.
    `static <T> HttpResponse.Builder<T>` | `builder(int statusCode, Class<? extends T> payloadType)` Get a builder to create a default `HttpResponse` instance.
    `default HttpStatus` | `getStatus()` Get the response status as `HttpStatus`
    `int` | `getStatusCode()` Get the response status code

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

    - #### getStatusCode

          int getStatusCode()

      Get the response status code
      Returns:
        the response status code

    - #### getStatus

          default HttpStatus getStatus()

      Get the response status as `HttpStatus`
      Returns:
        the response HttpStatus
      Throws:
        `InvalidHttpMessageException` - If the status code of the message does not corresponds to any of the `HttpStatus` values

    - #### builder

          static <T> HttpResponse.Builder<T> builder(int statusCode,
                                                     Class<? extends T> payloadType)

      Get a builder to create a default `HttpResponse` instance.
      Type Parameters:
        `T` - Payload type
      Parameters:
        `statusCode` - Response status code
        `payloadType` - Payload type
      Returns:
        A new `HttpResponse` builder

    - #### builder

          static <T> HttpResponse.Builder<T> builder(HttpStatus status,
                                                     Class<? extends T> payloadType)

      Get a builder to create a default `HttpResponse` instance.
      Type Parameters:
        `T` - Payload type
      Parameters:
        `status` - Response status (not null)
        `payloadType` - Payload type
      Returns:
        A new `HttpResponse` builder

Copyright © 2019 The Holon Platform. All rights reserved.