public class WebResponseWrapper extends Object implements WebResponse
WebResponse
interface that can be subclassed
by developers wishing to adapt a particular WebResponse.
This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped
web connection object.Constructor and Description |
---|
WebResponseWrapper(WebResponse webResponse)
Constructs a WebResponse object wrapping provided WebResponse.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
getContentAsStream()
Return the content from the server as an input stream
|
String |
getContentAsString()
Return the content from the server as a string
|
String |
getContentCharSet()
Return the content charset value.
|
String |
getContentType()
Return the content type returned from the server.
|
long |
getLoadTimeInMilliSeconds()
Return the time it took to load this web response in milliseconds.
|
SubmitMethod |
getRequestMethod()
Return the method used for the request resulting into this response.
|
byte[] |
getResponseBody()
Return the response body as byte array.
|
List |
getResponseHeaders()
Return the response headers as a List of
NameValuePair s. |
String |
getResponseHeaderValue(String headerName)
Return the value of the specified header from this response.
|
int |
getStatusCode()
Return the status code that was returned by the server
|
String |
getStatusMessage()
Return the status message that was returned from the server
|
URL |
getUrl()
Return the URL that was used to load this page.
|
public WebResponseWrapper(WebResponse webResponse) throws IllegalArgumentException
webResponse
- the webResponse that does the real workIllegalArgumentException
- if the connection is null
public InputStream getContentAsStream() throws IOException
getContentAsStream
in interface WebResponse
IOException
- If an IO problem occurspublic String getContentAsString()
getContentAsString
in interface WebResponse
public String getContentCharSet()
getContentCharSet
in interface WebResponse
public String getContentType()
getContentType
in interface WebResponse
public long getLoadTimeInMilliSeconds()
getLoadTimeInMilliSeconds
in interface WebResponse
public SubmitMethod getRequestMethod()
getRequestMethod
in interface WebResponse
public byte[] getResponseBody()
getResponseBody
in interface WebResponse
public List getResponseHeaders()
NameValuePair
s.
The default behavior of this method is to return getResponseHeaders() on the wrapped connection object.getResponseHeaders
in interface WebResponse
NameValuePair
s.public String getResponseHeaderValue(String headerName)
getResponseHeaderValue
in interface WebResponse
headerName
- The name of the headerpublic int getStatusCode()
getStatusCode
in interface WebResponse
public String getStatusMessage()
getStatusMessage
in interface WebResponse
public URL getUrl()
getUrl
in interface WebResponse
Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.