|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.htmlunit.WebResponse
com.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 response object.
Constructor Summary | |
---|---|
WebResponseWrapper(WebResponse webResponse)
Constructs a WebResponse object wrapping provided WebResponse. |
Method Summary | |
---|---|
byte[] |
getContentAsBytes()
Deprecated. as of 2.8, use either getContentAsString() or getContentAsStream() . |
InputStream |
getContentAsStream()
Returns the response content as an input stream. |
String |
getContentAsString()
Returns the response content as a string, using the charset/encoding specified in the server response. |
String |
getContentAsString(String encoding)
Returns the response content as a string, using the specified charset/encoding, rather than the charset/encoding specified in the server response. |
String |
getContentCharset()
Returns the content charset for this response, even if no charset was specified explicitly. |
String |
getContentCharsetOrNull()
Returns the content charset specified explicitly in the header or in the content, or null if none was specified. |
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. |
WebRequest |
getRequestSettings()
Deprecated. as of 2.8, please use getWebRequest() instead |
URL |
getRequestUrl()
Returns the URL that was used to load this page. |
List<NameValuePair> |
getResponseHeaders()
Returns the response headers as a list of NameValuePair s. |
String |
getResponseHeaderValue(String headerName)
Returns the value of the specified response header. |
int |
getStatusCode()
Returns the status code that was returned by the server. |
String |
getStatusMessage()
Returns the status message that was returned from the server. |
WebRequest |
getWebRequest()
Returns the request used to load this response. |
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 webResponse is null
Method Detail |
---|
public InputStream getContentAsStream()
getContentAsStream
in class WebResponse
public String getContentAsString()
getContentAsString
in class WebResponse
public String getContentAsString(String encoding)
getContentAsString
in class WebResponse
encoding
- the charset/encoding to use to convert the response content into a string
@Deprecated public byte[] getContentAsBytes()
getContentAsString()
or getContentAsStream()
.
getContentAsBytes
in class WebResponse
public String getContentCharsetOrNull()
getContentCharsetOrNull
in class WebResponse
public String getContentCharset()
TextUtil.DEFAULT_CHARSET
.
The default behavior of this method is to return getContentCharset() on the wrapped webResponse object.
getContentCharset
in class WebResponse
public String getContentType()
getContentType
in class WebResponse
public long getLoadTime()
getLoadTime
in class WebResponse
public List<NameValuePair> getResponseHeaders()
NameValuePair
s.
The default behavior of this method is to return getResponseHeaders() on the wrapped webResponse object.
getResponseHeaders
in class WebResponse
NameValuePair
spublic String getResponseHeaderValue(String headerName)
getResponseHeaderValue
in class WebResponse
headerName
- the name of the header whose value is to be returned
null
if no response header exists with this namepublic int getStatusCode()
getStatusCode
in class WebResponse
public String getStatusMessage()
getStatusMessage
in class WebResponse
@Deprecated public WebRequest getRequestSettings()
getWebRequest()
instead
getRequestSettings
in class WebResponse
public WebRequest getWebRequest()
getWebRequest
in class WebResponse
public URL getRequestUrl()
getRequestUrl
in class WebResponse
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |