Package snap.web

Class HTTPRequest

java.lang.Object
snap.web.HTTPRequest

public class HTTPRequest extends Object
A class to represent an HTTP request and generate a response.
  • Constructor Details

    • HTTPRequest

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

      public HTTPRequest(String aString)
      Creates a new URL from string.
  • Method Details

    • getURL

      public URL getURL()
      Returns the URL.
    • getURLString

      public String getURLString()
      Returns the URL string.
    • getMethod

      public String getMethod()
      Returns the request method (always upper case).
    • setMethod

      public void setMethod(String aMethod)
      Sets the request method.
    • getCookie

      public String getCookie()
      Returns the cookie.
    • setCookie

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

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

      public void addHeader(String aKey, 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 IOException
      Executes this request and returns a response.
      Throws:
      IOException
    • toString

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