## com.gargoylesoftware.htmlunit
Class WebResponseData

    java.lang.Object
      com.gargoylesoftware.htmlunit.WebResponseData

All Implemented Interfaces:
  java.io.Serializable

    public class WebResponseData

extends java.lang.Object
implements java.io.Serializable

Simple data object to simplify WebResponse creation.

Version:
  $Revision: 6204 $
Author:
  Brad Clarke, Daniel Gredler, Ahmed Ashour
See Also:
  Serialized Form

Constructor Summary
`` `WebResponseData(byte[] body, int statusCode, java.lang.String statusMessage, java.util.List<org.apache.commons.httpclient.NameValuePair> responseHeaders)` Constructs with a raw byte[] (mostly for testing).
`` `WebResponseData(DownloadedContent responseBody, int statusCode, java.lang.String statusMessage, java.util.List<org.apache.commons.httpclient.NameValuePair> responseHeaders)` Constructor.
`` `WebResponseData(java.io.InputStream bodyStream, int statusCode, java.lang.String statusMessage, java.util.List<org.apache.commons.httpclient.NameValuePair> responseHeaders)` Deprecated. As of HtmlUnit-2.8.
`protected` `WebResponseData(int statusCode, java.lang.String statusMessage, java.util.List<org.apache.commons.httpclient.NameValuePair> responseHeaders)` Constructs without data stream for subclasses that override getBody().

Method Summary
`byte[]` `getBody()` Returns the response body.
`java.io.InputStream` `getInputStream()` Returns a new `InputStream` allowing to read the downloaded content.
`java.util.List<org.apache.commons.httpclient.NameValuePair>` `getResponseHeaders()`
`int` `getStatusCode()`
`java.lang.String` `getStatusMessage()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WebResponseData

    public WebResponseData(byte[] body,
                           int statusCode,
                           java.lang.String statusMessage,
                           java.util.List<org.apache.commons.httpclient.NameValuePair> responseHeaders)

  Constructs with a raw byte[] (mostly for testing).

  Parameters:
    `body` - Body of this response
    `statusCode` - Status code from the server
    `statusMessage` - Status message from the server
    `responseHeaders` - Headers in this response
  Throws:
    `java.io.IOException` - on stream errors

### WebResponseData

    @Deprecated
    public WebResponseData(java.io.InputStream bodyStream,
                                      int statusCode,
                                      java.lang.String statusMessage,
                                      java.util.List<org.apache.commons.httpclient.NameValuePair> responseHeaders)
                    throws java.io.IOException

  Deprecated. As of HtmlUnit-2.8.

  Constructs with a data stream to minimize copying of the entire body.

  Parameters:
    `bodyStream` - Stream of this response's body
    `statusCode` - Status code from the server
    `statusMessage` - Status message from the server
    `responseHeaders` - Headers in this response
  Throws:
    `java.io.IOException` - on stream errors

### WebResponseData

    protected WebResponseData(int statusCode,
                              java.lang.String statusMessage,
                              java.util.List<org.apache.commons.httpclient.NameValuePair> responseHeaders)
                       throws java.io.IOException

  Constructs without data stream for subclasses that override getBody().

  Parameters:
    `statusCode` - Status code from the server
    `statusMessage` - Status message from the server
    `responseHeaders` - Headers in this response
  Throws:
    `java.io.IOException` - on stream errors

### WebResponseData

    public WebResponseData(DownloadedContent responseBody,
                           int statusCode,
                           java.lang.String statusMessage,
                           java.util.List<org.apache.commons.httpclient.NameValuePair> responseHeaders)

  Constructor.

  Parameters:
    `responseBody` - the downloaded response body
    `statusCode` - Status code from the server
    `statusMessage` - Status message from the server
    `responseHeaders` - Headers in this response
  Throws:
    `java.io.IOException` - on stream errors

Method Detail

### getBody

    public byte[] getBody()

  Returns the response body. This may cause memory problem for very large responses.

  Returns:
    response body

### getInputStream

    public java.io.InputStream getInputStream()

  Returns a new `InputStream` allowing to read the downloaded content.

  Returns:
    the associated InputStream

### getResponseHeaders

    public java.util.List<org.apache.commons.httpclient.NameValuePair> getResponseHeaders()

  Returns:
    response headers

### getStatusCode

    public int getStatusCode()

  Returns:
    response status code

### getStatusMessage

    public java.lang.String getStatusMessage()

  Returns:
    response status message

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