Class HttpResponse
java.lang.Object
ee.jakarta.tck.pages.common.client.http.HttpResponse
This class represents an HTTP response from the server.
-
Constructor Summary
ConstructorsConstructorDescriptionHttpResponse(String host, int port, boolean isSecure, org.apache.http.client.methods.HttpUriRequest request, org.apache.http.HttpResponse response) Creates new HttpResponse -
Method Summary
Modifier and TypeMethodDescriptiongetHost()getPath()intgetPort()Returns the HTTP reason-phrase returned by the serverbyte[]Returns the response body as a byte array.Returns the response body as an InputStream.Returns the response body as a string using the charset specified in the server's response.Returns the charset encoding for this response.org.apache.http.HeadergetResponseHeader(String headerName) Returns the response header designated by the name provided.org.apache.http.Header[]Returns the headers received in the response from the server.org.apache.http.Header[]getResponseHeaders(String headerName) Returns the headers designated by the name provided.Returns the HTTP status code returned by the servertoString()Displays a String representation of the response.
-
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
Returns the HTTP status code returned by the server- Returns:
- HTTP status code
-
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
Returns the headers designated by the name provided.- Returns:
- response headers
-
getResponseHeader
Returns the response header designated by the name provided.- Returns:
- a specfic response header or null if the specified header doesn't exist.
-
getResponseBodyAsBytes
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
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
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
Returns the charset encoding for this response.- Returns:
- charset encoding
-
toString
Displays a String representation of the response. -
getHost
-
getPort
public int getPort() -
getProtocol
-
getPath
-