public class WebResponseImpl extends Object implements WebResponse
WebResponse
.Constructor and Description |
---|
WebResponseImpl(WebResponseData responseData,
String charset,
WebRequestSettings requestSettings,
long loadTime)
Deprecated.
As of 2.6, please use @link
WebResponseImpl(WebResponseData, WebRequestSettings, long) |
WebResponseImpl(WebResponseData responseData,
URL url,
HttpMethod requestMethod,
long loadTime)
Constructs with all data.
|
WebResponseImpl(WebResponseData responseData,
WebRequestSettings requestSettings,
long loadTime)
Constructs with all data.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getContentAsBytes()
Returns the response content as a byte array.
|
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 |
getContentCharSet()
Deprecated.
As of 2.6, please use @link
getContentCharset() |
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.
|
HttpMethod |
getRequestMethod()
Deprecated.
As of 2.6, please use
getRequestSettings() .getHttpMethod() |
WebRequestSettings |
getRequestSettings()
Returns the request settings used to load this response.
|
URL |
getRequestUrl()
Deprecated.
As of 2.6, please use
getRequestSettings() .getUrl() |
List<org.apache.commons.httpclient.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.
|
URL |
getUrl()
Synonym for
WebResponse.getRequestUrl() |
public WebResponseImpl(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@Deprecated public WebResponseImpl(WebResponseData responseData, String charset, WebRequestSettings requestSettings, long loadTime)
WebResponseImpl(WebResponseData, WebRequestSettings, long)
responseData
- Data that was send backcharset
- Charset used if not returned in the responserequestSettings
- the request settings used to get this responseloadTime
- How long the response took to be sentpublic WebResponseImpl(WebResponseData responseData, WebRequestSettings requestSettings, long loadTime)
responseData
- Data that was send backrequestSettings
- the request settings used to get this responseloadTime
- How long the response took to be sentpublic WebRequestSettings getRequestSettings()
getRequestSettings
in interface WebResponse
@Deprecated public HttpMethod getRequestMethod()
getRequestSettings()
.getHttpMethod()getRequestMethod
in interface WebResponse
@Deprecated public URL getRequestUrl()
getRequestSettings()
.getUrl()getRequestUrl
in interface WebResponse
public URL getUrl()
WebResponse
WebResponse.getRequestUrl()
getUrl
in interface WebResponse
public List<org.apache.commons.httpclient.NameValuePair> getResponseHeaders()
NameValuePair
s.getResponseHeaders
in interface WebResponse
NameValuePair
spublic String getResponseHeaderValue(String headerName)
getResponseHeaderValue
in interface WebResponse
headerName
- the name of the header whose value is to be returnedpublic int getStatusCode()
getStatusCode
in interface WebResponse
public String getStatusMessage()
getStatusMessage
in interface WebResponse
public String getContentType()
getContentType
in interface WebResponse
@Deprecated public String getContentCharSet()
getContentCharset()
getContentCharSet
in interface WebResponse
TextUtil.DEFAULT_CHARSET
if it can't be determinedpublic String getContentCharsetOrNull()
getContentCharsetOrNull
in interface WebResponse
public String getContentCharset()
TextUtil.DEFAULT_CHARSET
.getContentCharset
in interface WebResponse
public String getContentAsString()
getContentAsString
in interface WebResponse
public String getContentAsString(String encoding)
getContentAsString
in interface WebResponse
encoding
- the charset/encoding to use to convert the response content into a stringpublic InputStream getContentAsStream() throws IOException
getContentAsStream
in interface WebResponse
IOException
- if an IO problem occurspublic byte[] getContentAsBytes()
getContentAsBytes
in interface WebResponse
public long getLoadTime()
getLoadTime
in interface WebResponse
Copyright © 2002–2014 Gargoyle Software Inc.. All rights reserved.