Class HttpResponse

java.lang.Object
ee.jakarta.tck.ws.rs.common.webclient.http.HttpResponse
Direct Known Subclasses:
ApacheResponseAdapter

public class HttpResponse extends Object
This class represents an HTTP response from the server.
  • Constructor Details

    • HttpResponse

      public HttpResponse(String host, int port, boolean isSecure, org.apache.commons.httpclient.HttpMethod method, org.apache.commons.httpclient.HttpState state)
      Creates new HttpResponse
  • Method Details

    • getStatusCode

      public String getStatusCode()
      Returns the HTTP status code returned by the server
      Returns:
      HTTP status code
    • getReasonPhrase

      public String getReasonPhrase()
      Returns the HTTP reason-phrase returned by the server
      Returns:
      HTTP reason-phrase
    • getResponseHeaders

      public org.apache.commons.httpclient.Header[] getResponseHeaders()
      Returns the headers received in the response from the server.
      Returns:
      response headers
    • getResponseHeaders

      public org.apache.commons.httpclient.Header[] getResponseHeaders(String headerName)
      Returns the headers designated by the name provided.
      Returns:
      response headers
    • getResponseHeader

      public org.apache.commons.httpclient.Header getResponseHeader(String headerName)
      Returns the response header designated by the name provided.
      Returns:
      a specfic response header or null if the specified header doesn't exist.
    • getResponseBodyAsBytes

      public byte[] getResponseBodyAsBytes() throws IOException
      Returns the response body as a byte array using the charset specified in the server's response.
      Returns:
      response body as an array of bytes.
      Throws:
      IOException
    • getResponseBodyAsRawBytes

      public byte[] getResponseBodyAsRawBytes() throws IOException
      Returns the response as bytes (no encoding is performed by client.
      Returns:
      the raw response bytes
      Throws:
      IOException - if an error occurs reading from server
    • getResponseBodyAsString

      public String getResponseBodyAsString() throws IOException
      Returns the response body as a string using the charset specified in the server's response.
      Returns:
      response body as a String
      Throws:
      IOException
    • getResponseBodyAsRawString

      public String getResponseBodyAsRawString() throws IOException
      Returns the response body of the server without being encoding by the client.
      Returns:
      an unecoded String representation of the response
      Throws:
      IOException - if an error occurs reading from the server
    • getResponseBodyAsStream

      public InputStream getResponseBodyAsStream() throws IOException
      Returns the response body as an InputStream using the encoding specified in the server's response.
      Returns:
      response body as an InputStream
      Throws:
      IOException
    • getResponseBodyAsRawStream

      public InputStream getResponseBodyAsRawStream() throws IOException
      Returns the response body as an InputStream without any encoding applied by the client.
      Returns:
      an InputStream to read the response
      Throws:
      IOException - if an error occurs reading from the server
    • getResponseEncoding

      public String getResponseEncoding()
      Returns the charset encoding for this response.
      Returns:
      charset encoding
    • getState

      public org.apache.commons.httpclient.HttpState getState()
      Returns the post-request state.
      Returns:
      an HttpState object
    • toString

      public String toString()
      Displays a String representation of the response.
      Overrides:
      toString in class Object
      Returns:
      string representation of response
    • getHost

      public String getHost()
    • getPort

      public int getPort()
    • getProtocol

      public String getProtocol()
    • getPath

      public String getPath()