Class HttpResponseImpl<T>

java.lang.Object
org.seppiko.commons.utils.http.HttpResponseImpl<T>
All Implemented Interfaces:
HttpResponse<T>

public class HttpResponseImpl<T> extends Object implements HttpResponse<T>
HttpResponse implementation
Author:
Leonard Woo
  • Constructor Details

  • Method Details

    • statusCode

      public int statusCode()
      Returns the status code for this response.
      Specified by:
      statusCode in interface HttpResponse<T>
      Returns:
      the response code
    • request

      public HttpRequest request()
      Returns the HttpRequest corresponding to this response.
      Specified by:
      request in interface HttpResponse<T>
      Returns:
      the request
      See Also:
    • previousResponse

      public Optional<HttpResponse<T>> previousResponse()
      Returns an Optional containing the previous intermediate response if one was received.
      Specified by:
      previousResponse in interface HttpResponse<T>
      Returns:
      an Optional containing the HttpResponse, if any.
    • headers

      public HttpHeaders headers()
      Returns the received response headers.
      Specified by:
      headers in interface HttpResponse<T>
      Returns:
      the response headers
    • body

      public T body()
      Returns the body.

      If this HttpResponse was returned from an invocation of previousResponse() then this method returns null

      Specified by:
      body in interface HttpResponse<T>
      Returns:
      the body
    • sslSession

      public Optional<SSLSession> sslSession()
      Returns an Optional containing the SSLSession in effect for this response.
      Specified by:
      sslSession in interface HttpResponse<T>
      Returns:
      an Optional containing the SSLSession associated with the response
    • uri

      public URI uri()
      Returns the URI that the response was received from. This may be different from the request URI if redirection occurred.
      Specified by:
      uri in interface HttpResponse<T>
      Returns:
      the URI of the response
    • version

      public HttpClient.Version version()
      Returns the HTTP protocol version that was used for this response.
      Specified by:
      version in interface HttpResponse<T>
      Returns:
      HTTP protocol version