Class HttpResponse

java.lang.Object
ee.jakarta.tck.pages.common.client.http.HttpResponse

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.http.client.methods.HttpUriRequest request, org.apache.http.HttpResponse response)
      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.http.Header[] getResponseHeaders()
      Returns the headers received in the response from the server.
      Returns:
      response headers
    • getResponseHeaders

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

      public org.apache.http.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.
      Returns:
      response body as an array of bytes.
      Throws:
      IOException - If an error occurs reading the reading the response body
    • 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 - If an error occurs reading the reading the response body
    • getResponseBodyAsStream

      public InputStream getResponseBodyAsStream() throws IOException
      Returns the response body as an InputStream.
      Returns:
      response body as an InputStream
      Throws:
      IOException - If an error occurs reading the reading the response body
    • getResponseEncoding

      public String getResponseEncoding()
      Returns the charset encoding for this response.
      Returns:
      charset encoding
    • 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()