Class HTTPRequest


  • public class HTTPRequest
    extends java.lang.Object
    A class to represent an HTTP request and generate a response.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  HTTPRequest.Header
      A class to hold headers.
    • Constructor Summary

      Constructors 
      Constructor Description
      HTTPRequest​(java.lang.String aString)
      Creates a new URL from string.
      HTTPRequest​(java.net.URL aURL)
      Creates a new URL from Java URL.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addHeader​(java.lang.String aKey, java.lang.String aValue)
      Adds a header for key.
      byte[] getBytes()
      Returns the bytes associated with request (POST).
      java.lang.String getCookie()
      Returns the cookie.
      java.util.List<HTTPRequest.Header> getHeaders()
      Returns the headers.
      HTTPResponse getResponse()
      Executes this request and returns a response.
      java.net.URL getURL()
      Returns the URL.
      java.lang.String getURLString()
      Returns the URL string.
      void setBytes​(byte[] theBytes)
      Sets the bytes associated with the request (POST).
      void setCookie​(java.lang.String aString)
      Sets the cookie.
      java.lang.String toString()
      Standard toString implementation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HTTPRequest

        public HTTPRequest​(java.net.URL aURL)
        Creates a new URL from Java URL.
      • HTTPRequest

        public HTTPRequest​(java.lang.String aString)
        Creates a new URL from string.
    • Method Detail

      • getURL

        public java.net.URL getURL()
        Returns the URL.
      • getURLString

        public java.lang.String getURLString()
        Returns the URL string.
      • getCookie

        public java.lang.String getCookie()
        Returns the cookie.
      • setCookie

        public void setCookie​(java.lang.String aString)
        Sets the cookie.
      • getHeaders

        public java.util.List<HTTPRequest.Header> getHeaders()
        Returns the headers.
      • addHeader

        public void addHeader​(java.lang.String aKey,
                              java.lang.String aValue)
        Adds a header for key.
      • getBytes

        public byte[] getBytes()
        Returns the bytes associated with request (POST).
      • setBytes

        public void setBytes​(byte[] theBytes)
        Sets the bytes associated with the request (POST).
      • getResponse

        public HTTPResponse getResponse()
                                 throws java.io.IOException
        Executes this request and returns a response.
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Standard toString implementation.
        Overrides:
        toString in class java.lang.Object