|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gargoylesoftware.htmlunit.WebResponse
public class WebResponse
A response from a web server.
| Constructor Summary | |
|---|---|
WebResponse(WebResponseData responseData,
URL url,
HttpMethod requestMethod,
long loadTime)
Constructs with all data. |
|
WebResponse(WebResponseData responseData,
WebRequest request,
long loadTime)
Constructs with all data. |
|
| Method Summary | |
|---|---|
void |
cleanUp()
Clean up the response data. |
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. |
List<NameValuePair> |
getResponseHeaders()
Returns the response headers as a list of NameValuePairs. |
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 WebResponse(WebResponseData responseData,
URL url,
HttpMethod requestMethod,
long loadTime)
responseData - Data that was send backurl - Where this response came fromrequestMethod - the method used to get this responseloadTime - How long the response took to be sent
public WebResponse(WebResponseData responseData,
WebRequest request,
long loadTime)
responseData - Data that was send backrequest - the request used to get this responseloadTime - How long the response took to be sent| Method Detail |
|---|
public WebRequest getWebRequest()
public List<NameValuePair> getResponseHeaders()
NameValuePairs.
NameValuePairspublic String getResponseHeaderValue(String headerName)
headerName - the name of the header whose value is to be returned
null if no response header exists with this namepublic int getStatusCode()
public String getStatusMessage()
public String getContentType()
public String getContentCharsetOrNull()
public String getContentCharset()
TextUtil.DEFAULT_CHARSET.
If no charset is defined for an xml respose, then UTF-8 is used ("http://www.w3.org/TR/xml/#charencoding"
public String getContentAsString()
public String getContentAsString(String encoding)
encoding - the charset/encoding to use to convert the response content into a string
public InputStream getContentAsStream()
throws IOException
IOException - in case of IOProblemspublic long getLoadTime()
public void cleanUp()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||