Class HTTPRequest
- java.lang.Object
-
- com.inductiveautomation.snap.websites.HTTPRequest
-
public class HTTPRequest extends java.lang.ObjectA class to represent an HTTP request and generate a response.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHTTPRequest.HeaderA 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 voidaddHeader(java.lang.String aKey, java.lang.String aValue)Adds a header for key.byte[]getBytes()Returns the bytes associated with request (POST).java.lang.StringgetCookie()Returns the cookie.java.util.List<HTTPRequest.Header>getHeaders()Returns the headers.HTTPResponsegetResponse()Executes this request and returns a response.java.net.URLgetURL()Returns the URL.java.lang.StringgetURLString()Returns the URL string.voidsetBytes(byte[] theBytes)Sets the bytes associated with the request (POST).voidsetCookie(java.lang.String aString)Sets the cookie.java.lang.StringtoString()Standard toString implementation.
-
-
-
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:
toStringin classjava.lang.Object
-
-