|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gargoylesoftware.htmlunit.util.WebResponseWrapper
public class WebResponseWrapper
Provides a convenient implementation of the 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 Summary | |
|---|---|
WebResponseWrapper(WebResponse webResponse)
Constructs a WebResponse object wrapping provided WebResponse. |
|
| Method Summary | |
|---|---|
byte[] |
getContentAsBytes()
Returns the response content as a byte array. |
java.io.InputStream |
getContentAsStream()
Returns the response content as an input stream. |
java.lang.String |
getContentAsString()
Returns the response content as a string, using the charset/encoding specified in the server response. |
java.lang.String |
getContentAsString(java.lang.String encoding)
Returns the response content as a string, using the specified charset/encoding, rather than the charset/encoding specified in the server response. |
java.lang.String |
getContentCharset()
Returns the content charset for this response, even if no charset was specified explicitly. |
java.lang.String |
getContentCharSet()
Deprecated. As of 2.6, please use @link getContentCharset() |
java.lang.String |
getContentCharsetOrNull()
Returns the content charset specified explicitly in the header or in the content, or null if none was specified. |
java.lang.String |
getContentType()
Returns the content type returned from the server, e.g. |
long |
getLoadTime()
Returns the time it took to load this web response, in milliseconds. |
HttpMethod |
getRequestMethod()
Deprecated. As of 2.6, please use getRequestSettings().getHttpMethod() |
WebRequestSettings |
getRequestSettings()
Returns the request settings used to load this response. |
java.net.URL |
getRequestUrl()
Deprecated. As of 2.6, please use getRequestSettings().getUrl() |
java.util.List<org.apache.commons.httpclient.NameValuePair> |
getResponseHeaders()
Returns the response headers as a list of NameValuePairs. |
java.lang.String |
getResponseHeaderValue(java.lang.String headerName)
Returns the value of the specified response header. |
int |
getStatusCode()
Returns the status code that was returned by the server. |
java.lang.String |
getStatusMessage()
Returns the status message that was returned from the server. |
java.net.URL |
getUrl()
Synonym for WebResponse.getRequestUrl() |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WebResponseWrapper(WebResponse webResponse)
throws java.lang.IllegalArgumentException
webResponse - the webResponse that does the real work
java.lang.IllegalArgumentException - if the connection is null| Method Detail |
|---|
public java.io.InputStream getContentAsStream()
throws java.io.IOException
getContentAsStream in interface WebResponsejava.io.IOException - if an IO problem occurspublic java.lang.String getContentAsString()
getContentAsString in interface WebResponsepublic java.lang.String getContentAsString(java.lang.String encoding)
getContentAsString in interface WebResponseencoding - the charset/encoding to use to convert the response content into a string
public byte[] getContentAsBytes()
getContentAsBytes in interface WebResponse@Deprecated public java.lang.String getContentCharSet()
getContentCharset()
getContentCharSet in interface WebResponsepublic java.lang.String getContentCharsetOrNull()
getContentCharsetOrNull in interface WebResponsepublic java.lang.String getContentCharset()
TextUtil.DEFAULT_CHARSET.
The default behavior of this method is to return getContentCharset() on the wrapped connection object.
getContentCharset in interface WebResponsepublic java.lang.String getContentType()
getContentType in interface WebResponsepublic long getLoadTime()
getLoadTime in interface WebResponse@Deprecated public HttpMethod getRequestMethod()
getRequestSettings().getHttpMethod()
getRequestMethod in interface WebResponsepublic java.util.List<org.apache.commons.httpclient.NameValuePair> getResponseHeaders()
NameValuePairs.
The default behavior of this method is to return getResponseHeaders() on the wrapped connection object.
getResponseHeaders in interface WebResponseNameValuePairspublic java.lang.String getResponseHeaderValue(java.lang.String headerName)
getResponseHeaderValue in interface WebResponseheaderName - the name of the header whose value is to be returned
public int getStatusCode()
getStatusCode in interface WebResponsepublic java.lang.String getStatusMessage()
getStatusMessage in interface WebResponse@Deprecated public java.net.URL getRequestUrl()
getRequestSettings().getUrl()
getRequestUrl in interface WebResponsepublic java.net.URL getUrl()
WebResponseWebResponse.getRequestUrl()
getUrl in interface WebResponsepublic WebRequestSettings getRequestSettings()
getRequestSettings in interface WebResponse
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||