|
||||||||||
| 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 | |
|---|---|
InputStream |
getContentAsStream()
Return the content from the server as an input stream The default behavior of this method is to return getContentAsStream() on the wrapped connection object. |
String |
getContentAsString()
Return the content from the server as a string The default behavior of this method is to return getContentAsString() on the wrapped connection object. |
String |
getContentCharSet()
Return the content charset value. The default behavior of this method is to return getContentCharSet() on the wrapped connection object. |
String |
getContentType()
Return the content type returned from the server. The default behavior of this method is to return getContentType() on the wrapped connection object. |
long |
getLoadTimeInMilliSeconds()
Return the time it took to load this web response in milliseconds. The default behavior of this method is to return getLoadTimeInMilliSeconds() on the wrapped connection object. |
SubmitMethod |
getRequestMethod()
Return the method used for the request resulting into this response. The default behavior of this method is to return getRequestMethod() on the wrapped connection object. |
byte[] |
getResponseBody()
Return the response body as byte array. The default behavior of this method is to return getResponseBody() on the wrapped connection object. |
List |
getResponseHeaders()
Return the response headers as a List of NameValuePairs.
The default behavior of this method is to return getResponseHeaders() on the wrapped connection object. |
String |
getResponseHeaderValue(String headerName)
Return the value of the specified header from this response. The default behavior of this method is to return getResponseHeaderValue() on the wrapped connection object. |
int |
getStatusCode()
Return the status code that was returned by the server The default behavior of this method is to return getStatusCode() on the wrapped connection object. |
String |
getStatusMessage()
Return the status message that was returned from the server The default behavior of this method is to return getStatusMessage() on the wrapped connection object. |
URL |
getUrl()
Return the URL that was used to load this page. The default behavior of this method is to return getUrl() on the wrapped connection object. |
| 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 IllegalArgumentException
webResponse - the webResponse that does the real work
IllegalArgumentException - if the connection is null| Method Detail |
|---|
public InputStream getContentAsStream()
throws IOException
getContentAsStream in interface WebResponseIOException - If an IO problem occurspublic String getContentAsString()
getContentAsString in interface WebResponsepublic String getContentCharSet()
getContentCharSet in interface WebResponsepublic String getContentType()
getContentType in interface WebResponsepublic long getLoadTimeInMilliSeconds()
getLoadTimeInMilliSeconds in interface WebResponsepublic SubmitMethod getRequestMethod()
getRequestMethod in interface WebResponsepublic byte[] getResponseBody()
getResponseBody in interface WebResponsepublic List getResponseHeaders()
NameValuePairs.
The default behavior of this method is to return getResponseHeaders() on the wrapped connection object.
getResponseHeaders in interface WebResponseNameValuePairs.public String getResponseHeaderValue(String headerName)
getResponseHeaderValue in interface WebResponseheaderName - The name of the header
public int getStatusCode()
getStatusCode in interface WebResponsepublic String getStatusMessage()
getStatusMessage in interface WebResponsepublic URL getUrl()
getUrl in interface WebResponse
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||