JavaScript is disabled on your browser.
Skip navigation links
org.htmlunit

Class WebResponseData

  • All Implemented Interfaces:
    Serializable


    public class WebResponseData
    extends Object
    implements Serializable 
    Simple data object to simplify WebResponse creation.
    Author:
    Brad Clarke, Daniel Gredler, Ahmed Ashour, Ronald Brill
    See Also:
    Serialized Form
    • Constructor Detail

      • WebResponseData

        public WebResponseData(byte[] body,
         int statusCode,
         String statusMessage,
         List<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
      • WebResponseData

        protected WebResponseData(int statusCode,
         String statusMessage,
         List<NameValuePair> responseHeaders)
        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
      • WebResponseData

        public WebResponseData(DownloadedContent downloadedContent,
         int statusCode,
         String statusMessage,
         List<NameValuePair> responseHeaders)
        Constructor.
        Parameters:
        downloadedContent - the downloaded content
        statusCode - Status code from the server
        statusMessage - Status message from the server
        responseHeaders - Headers in this response
    • Method Detail

      • getBody

        public byte[] getBody()
        Returns the response body. This may cause memory problem for very large responses.
        Returns:
        response body
      • getInputStreamWithBomIfApplicable

        public InputStream getInputStreamWithBomIfApplicable(org.apache.commons.io.ByteOrderMark... bomHeaders)
         throws IOException 
        INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
        Parameters:
        bomHeaders - the supported bomHeaders
        Returns:
        the associated InputStream wrapped with a bom input stream if applicable
        Throws:
        IOException - in case of IO problems
      • getResponseHeaders

        public List<NameValuePair> getResponseHeaders()
        Returns:
        response headers
      • getStatusCode

        public int getStatusCode()
        Returns:
        response status code
      • getStatusMessage

        public String getStatusMessage()
        Returns:
        response status message
      • getContentLength

        public long getContentLength()
        Returns length of the content data.
        Returns:
        the length
      • cleanUp

        public void cleanUp()
        Clean up the downloaded content.
Skip navigation links

Copyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.

AltStyle によって変換されたページ (->オリジナル) /