Class HttpResponse
java.lang.Object
ee.jakarta.tck.ws.rs.common.webclient.http.HttpResponse
- Direct Known Subclasses:
ApacheResponseAdapter
This class represents an HTTP response from the server.
-
Constructor Summary
ConstructorsConstructorDescriptionHttpResponse
(String host, int port, boolean isSecure, org.apache.commons.httpclient.HttpMethod method, org.apache.commons.httpclient.HttpState state) Creates new HttpResponse -
Method Summary
Modifier and TypeMethodDescriptiongetHost()
getPath()
int
getPort()
Returns the HTTP reason-phrase returned by the serverbyte[]
Returns the response body as a byte array using the charset specified in the server's response.byte[]
Returns the response as bytes (no encoding is performed by client.Returns the response body as an InputStream without any encoding applied by the client.Returns the response body of the server without being encoding by the client.Returns the response body as an InputStream using the encoding specified in the server's response.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.commons.httpclient.Header
getResponseHeader
(String headerName) Returns the response header designated by the name provided.org.apache.commons.httpclient.Header[]
Returns the headers received in the response from the server.org.apache.commons.httpclient.Header[]
getResponseHeaders
(String headerName) Returns the headers designated by the name provided.org.apache.commons.httpclient.HttpState
getState()
Returns the post-request state.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.commons.httpclient.HttpMethod method, org.apache.commons.httpclient.HttpState state) 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.commons.httpclient.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 using the charset specified in the server's response.- Returns:
- response body as an array of bytes.
- Throws:
IOException
-
getResponseBodyAsRawBytes
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
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
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
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
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
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
Displays a String representation of the response. -
getHost
-
getPort
public int getPort() -
getProtocol
-
getPath
-