Package snap.web
Class HTTPRequest
java.lang.Object
snap.web.HTTPRequest
A class to represent an HTTP request and generate a response.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionHTTPRequest
(String aString) Creates a new URL from string.HTTPRequest
(URL aURL) Creates a new URL from Java URL. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a header for key.byte[]
getBytes()
Returns the bytes associated with request (POST).Returns the cookie.Returns the headers.Returns the request method (always upper case).Executes this request and returns a response.getURL()
Returns the URL.Returns the URL string.void
setBytes
(byte[] theBytes) Sets the bytes associated with the request (POST).void
Sets the cookie.void
Sets the request method.toString()
Standard toString implementation.
-
Constructor Details
-
HTTPRequest
Creates a new URL from Java URL. -
HTTPRequest
Creates a new URL from string.
-
-
Method Details
-
getURL
Returns the URL. -
getURLString
Returns the URL string. -
getMethod
Returns the request method (always upper case). -
setMethod
Sets the request method. -
getCookie
Returns the cookie. -
setCookie
Sets the cookie. -
getHeaders
Returns the headers. -
addHeader
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
Executes this request and returns a response.- Throws:
IOException
-
toString
Standard toString implementation.
-