Class HttpResponse
java.lang.Object
com.sun.ts.tests.common.webclient.http.HttpResponse
This class represents an HTTP response from the server.
- 
Constructor SummaryConstructorsConstructorDescriptionHttpResponse(String host, int port, boolean isSecure, org.apache.commons.httpclient.HttpMethod method, org.apache.commons.httpclient.HttpState state) Creates new HttpResponse
- 
Method SummaryModifier and TypeMethodDescriptiongetHost()getPath()intgetPort()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.HeadergetResponseHeader(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.HttpStategetState()Returns the post-request state.Returns the HTTP status code returned by the servertoString()Displays a String representation of the response.
- 
Constructor Details- 
HttpResponsepublic HttpResponse(String host, int port, boolean isSecure, org.apache.commons.httpclient.HttpMethod method, org.apache.commons.httpclient.HttpState state) Creates new HttpResponse
 
- 
- 
Method Details- 
getStatusCodeReturns the HTTP status code returned by the server- Returns:
- HTTP status code
 
- 
getReasonPhraseReturns the HTTP reason-phrase returned by the server- Returns:
- HTTP reason-phrase
 
- 
getResponseHeaderspublic org.apache.commons.httpclient.Header[] getResponseHeaders()Returns the headers received in the response from the server.- Returns:
- response headers
 
- 
getResponseHeadersReturns the headers designated by the name provided.- Returns:
- response headers
 
- 
getResponseHeaderReturns the response header designated by the name provided.- Returns:
- a specfic response header or null if the specified header doesn't exist.
 
- 
getResponseBodyAsBytesReturns 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
 
- 
getResponseBodyAsRawBytesReturns the response as bytes (no encoding is performed by client.- Returns:
- the raw response bytes
- Throws:
- IOException- if an error occurs reading from server
 
- 
getResponseBodyAsStringReturns the response body as a string using the charset specified in the server's response.- Returns:
- response body as a String
- Throws:
- IOException
 
- 
getResponseBodyAsRawStringReturns 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
 
- 
getResponseBodyAsStreamReturns the response body as an InputStream using the encoding specified in the server's response.- Returns:
- response body as an InputStream
- Throws:
- IOException
 
- 
getResponseBodyAsRawStreamReturns 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
 
- 
getResponseEncodingReturns the charset encoding for this response.- Returns:
- charset encoding
 
- 
getStatepublic org.apache.commons.httpclient.HttpState getState()Returns the post-request state.- Returns:
- an HttpState object
 
- 
toStringDisplays a String representation of the response.
- 
getHost
- 
getPortpublic int getPort()
- 
getProtocol
- 
getPath
 
-