Class HttpContentResponse

java.lang.Object
org.eclipse.jetty.client.internal.HttpContentResponse
All Implemented Interfaces:
ContentResponse, Response

public class HttpContentResponse extends Object implements ContentResponse
  • Constructor Details

    • HttpContentResponse

      public HttpContentResponse(Response response, byte[] content, String mediaType, String encoding)
  • Method Details

    • getRequest

      public Request getRequest()
      Specified by:
      getRequest in interface Response
      Returns:
      the request associated with this response
    • getVersion

      public HttpVersion getVersion()
      Specified by:
      getVersion in interface Response
      Returns:
      the HTTP version of this response, such as "HTTP/1.1"
    • getStatus

      public int getStatus()
      Specified by:
      getStatus in interface Response
      Returns:
      the HTTP status code of this response, such as 200 or 404
    • getReason

      public String getReason()
      Specified by:
      getReason in interface Response
      Returns:
      the HTTP reason associated to the Response.getStatus()
    • getHeaders

      public HttpFields getHeaders()
      Description copied from interface: Response

      Returns the headers of this response.

      Some headers sent by the server may not be present, or be present but modified, while the content is being processed. A typical example is the Content-Length header when the content is sent compressed by the server and automatically decompressed by the client: the Content-Length header will be removed.

      Similarly, the Content-Encoding header may be removed or modified, as the content is decoded by the client.

      Specified by:
      getHeaders in interface Response
      Returns:
      the headers of this response
    • getTrailers

      public HttpFields getTrailers()
      Specified by:
      getTrailers in interface Response
      Returns:
      the trailers of this response
    • abort

      public CompletableFuture<Boolean> abort(Throwable cause)
      Description copied from interface: Response
      Attempts to abort the receive of this response.
      Specified by:
      abort in interface Response
      Parameters:
      cause - the abort cause, must not be null
      Returns:
      whether the abort succeeded
    • getMediaType

      public String getMediaType()
      Specified by:
      getMediaType in interface ContentResponse
      Returns:
      the media type of the content, such as "text/html" or "application/octet-stream"
    • getEncoding

      public String getEncoding()
      Specified by:
      getEncoding in interface ContentResponse
      Returns:
      the encoding of the content, such as "UTF-8"
    • getContent

      public byte[] getContent()
      Specified by:
      getContent in interface ContentResponse
      Returns:
      the response content
    • getContentAsString

      public String getContentAsString()
      Specified by:
      getContentAsString in interface ContentResponse
      Returns:
      the response content as a string, decoding the bytes using the charset provided by the Content-Type header, if any, or UTF-8.
    • toString

      public String toString()
      Overrides:
      toString in class Object