com.gargoylesoftware.htmlunit
Interface WebResponse

All Known Implementing Classes:
StringWebResponse, WebResponseImpl, WebResponseWrapper

public interface WebResponse

A response from a web server.

Version:
$Revision: 4002 $
Author:
Mike Bowler, Noboru Sinohara, Marc Guillemot, Ahmed Ashour

Method Summary
 byte[] getContentAsBytes()
          Returns the content from the server as a byte array.
 InputStream getContentAsStream()
          Returns the content from the server as an input stream.
 String getContentAsString()
          Returns the content from the server as a string, using the charset/encoding specified in the server response.
 String getContentAsString(String encoding)
          Returns the content from the server as a string, using the specified charset/encoding, rather than the charset/encoding specified in the server response.
 String getContentCharSet()
          Returns the content charset.
 String getContentType()
          Returns the content type returned from the server, i.e.
 long getLoadTime()
          Returns the time it took to load this web response, in milliseconds.
 long getLoadTimeInMilliSeconds()
          Deprecated. since 2.4, please use getLoadTime() instead
 HttpMethod getRequestMethod()
          Returns the method used for the request resulting in this response.
 WebRequestSettings getRequestSettings()
          Returns the request settings used to load this response.
 URL getRequestUrl()
          Returns the URL that was used to load this page.
 byte[] getResponseBody()
          Deprecated. since 2.4, please use getContentAsBytes() instead
 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.
 URL getUrl()
          Deprecated. since 2.4, please use getRequestUrl() instead
 

Method Detail

getRequestSettings

WebRequestSettings getRequestSettings()
Returns the request settings used to load this response.

Returns:
the request settings used to load this response

getRequestMethod

HttpMethod getRequestMethod()
Returns the method used for the request resulting in this response.

Returns:
the method used for the request resulting in this response

getRequestUrl

URL getRequestUrl()
Returns the URL that was used to load this page.

Returns:
the URL that was used to load this page

getResponseHeaders

List<NameValuePair> getResponseHeaders()
Returns the response headers as a list of NameValuePairs.

Returns:
the response headers as a list of NameValuePairs

getResponseHeaderValue

String getResponseHeaderValue(String headerName)
Returns the value of the specified response header.

Parameters:
headerName - the name of the header whose value is to be returned
Returns:
the value of the specified response header

getStatusCode

int getStatusCode()
Returns the status code that was returned by the server.

Returns:
the status code that was returned by the server

getStatusMessage

String getStatusMessage()
Returns the status message that was returned from the server.

Returns:
the status message that was returned from the server

getContentType

String getContentType()
Returns the content type returned from the server, i.e. "text/html".

Returns:
the content type returned from the server, i.e. "text/html"

getContentCharSet

String getContentCharSet()
Returns the content charset. The charset returned by this method is a valid, supported charset determined from the "Content-Type" header and from the response content.

Returns:
the content charset

getContentAsString

String getContentAsString()
Returns the content from the server as a string, using the charset/encoding specified in the server response.

Returns:
the content from the server as a string

getContentAsString

String getContentAsString(String encoding)
Returns the content from the server as a string, using the specified charset/encoding, rather than the charset/encoding specified in the server response. If the specified charset/encoding is not supported, the default system encoding is used.

Parameters:
encoding - the charset/encoding to use the convert the content into a string
Returns:
the content from the server as a string

getContentAsStream

InputStream getContentAsStream()
                               throws IOException
Returns the content from the server as an input stream.

Returns:
the content from the server as an input stream
Throws:
IOException - if an IO problem occurs

getContentAsBytes

byte[] getContentAsBytes()
Returns the content from the server as a byte array.

Returns:
the content from the server as a byte array

getLoadTime

long getLoadTime()
Returns the time it took to load this web response, in milliseconds.

Returns:
the time it took to load this web response, in milliseconds

getLoadTimeInMilliSeconds

@Deprecated
long getLoadTimeInMilliSeconds()
Deprecated. since 2.4, please use getLoadTime() instead

Returns the time it took to load this web response, in milliseconds.

Returns:
the time it took to load this web response, in milliseconds

getResponseBody

@Deprecated
byte[] getResponseBody()
Deprecated. since 2.4, please use getContentAsBytes() instead

Returns the response body, as a byte array.

Returns:
the response body, as a byte array

getUrl

@Deprecated
URL getUrl()
Deprecated. since 2.4, please use getRequestUrl() instead

Returns the URL that was used to load this page.

Returns:
the URL that was used to load this page


Copyright © 2002-2009 Gargoyle Software Inc.. All Rights Reserved.