Class HttpRequest

All Implemented Interfaces:
EventTarget, ScriptableDelegate, XMLHttpRequestEventTarget
Direct Known Subclasses:
XMLHttpRequestImpl

public class HttpRequest extends XMLHttpRequestEventTargetImpl

HttpRequest class.

  • Field Details

  • Constructor Details

    • HttpRequest

      public HttpRequest(Proxy proxy, String baseUrl)

      Constructor for HttpRequest.

      Parameters:
      proxy - a Proxy object.
      baseUrl - a URL object.
  • Method Details

    • abort

      public void abort()

      abort.

    • addReadyStateChangeListener

      public void addReadyStateChangeListener(ReadyStateChangeListener listener)

      addReadyStateChangeListener.

      Parameters:
      listener - a ReadyStateChangeListener object.
    • getAllResponseHeaders

      public String getAllResponseHeaders()

      getAllResponseHeaders.

      Returns:
      a String object.
    • getPostCharset

      protected String getPostCharset()
      This is the charset used to post data provided to send. It returns "UTF-8" unless overridden.
      Returns:
      a String object.
    • getReadyState

      public int getReadyState()

      Getter for the field readyState.

      Returns:
      a Integer object.
    • getResponseBytes

      public byte[] getResponseBytes()

      Getter for the field responseBytes.

      Returns:
      an array of
      invalid reference
      byte
      objects.
    • getResponseHeader

      public List<String> getResponseHeader(String headerName)

      getResponseHeader.

      Parameters:
      headerName - a String object.
      Returns:
      a List object.
    • getResponseText

      public String getResponseText()

      getResponseText.

      Returns:
      a String object.
    • getResponseXML

      public Document getResponseXML()

      getResponseXML.

      Returns:
      a Document object.
    • getStatus

      public int getStatus()

      Getter for the field status.

      Returns:
      a Integer object.
    • getStatusText

      public String getStatusText()

      Getter for the field statusText.

      Returns:
      a String object.
    • open

      public void open(String method, URI uri, boolean asyncFlag, String userName) throws Exception

      open.

      Parameters:
      method - a String object.
      uri - a URL object.
      asyncFlag - a boolean.
      userName - a String object.
      Throws:
      IOException - if any.
      Exception
    • open

      public void open(String method, String url) throws Exception

      open.

      Parameters:
      method - a String object.
      url - a String object.
      Throws:
      Exception - if any.
    • open

      public void open(String method, String url, boolean asyncFlag) throws Exception

      open.

      Parameters:
      method - a String object.
      url - a String object.
      asyncFlag - a boolean.
      Throws:
      Exception - if any.
    • open

      public void open(String method, URI uri) throws Exception

      open.

      Parameters:
      method - a String object.
      uri - a URL object.
      Throws:
      Exception - if any.
    • open

      public void open(String method, URI uri, boolean asyncFlag) throws Exception

      open.

      Parameters:
      method - a String object.
      uri - a URL object.
      asyncFlag - a boolean.
      Throws:
      Exception - if any.
    • open

      public void open(String method, String url, boolean async, String username) throws Exception

      open.

      Parameters:
      method - a String object.
      url - a URL object.
      async - a boolean.
      username - a String object.
      Throws:
      Exception - if any.
    • open

      public void open(String method, String url, boolean async, String username, String password) throws Exception

      open.

      Parameters:
      method - a String object.
      url - a URL object.
      async - a boolean.
      username - a String object.
      password - a String object.
      Throws:
      Exception - if any.
    • open

      public void open(String method, URI uri, boolean asyncFlag, String userName, String password) throws Exception
      Opens the request. Call send to complete it.
      Parameters:
      method - The request method.
      uri - The request URL.
      asyncFlag - Whether the request should be asynchronous.
      userName - The user name of the request (not supported.)
      password - The password of the request (not supported.)
      Throws:
      IOException - if any.
      Exception
    • send

      public void send(Object content, int timeout) throws Exception
      Sends POST content, if any, and causes the request to proceed.

      In the case of asynchronous requests, a new thread is created.

      Parameters:
      content - POST content or null if there's no such content.
      Throws:
      Exception - if any.