public interface Req
| Modifier and Type | Method and Description |
|---|---|
Req |
async()
Informs the HTTP server that the request will be handled asynchronously (typically on another thread).
|
<T> T |
attr(String name)
Returns the value of an extra attribute from the HTTP request, or throws a runtime exception if it is not
found.
|
<T> T |
attr(String name,
T defaultValue)
Returns the value of the specified extra attribute from the HTTP request, or the specified default value,
if it is not found.
|
Map<String,Object> |
attrs()
Gets the extra attributes of the HTTP request.
|
byte[] |
body()
Gets the raw body data of the HTTP request.
|
Req |
body(byte[] body)
Sets the raw body data of the HTTP request.
|
String |
clientIpAddress()
Gets the IP address of the HTTP client sending the request.
|
long |
connectionId()
Gets the HTTP connection ID, which is unique per HTTP server instance.
|
String |
cookie(String name)
Returns the value of the specified cookie from the HTTP request, or throws a runtime exception if it is
not found.
|
String |
cookie(String name,
String defaultValue)
Returns the value of the specified cookie from the HTTP request, or the specified default value, if it is
not found.
|
Map<String,Serializable> |
cookiepack()
Gets the cookie-persisted session attributes of the HTTP request.
|
<T extends Serializable> |
cookiepack(String name)
Returns the value of the specified cookie-persisted session attribute from the HTTP request, or throws a
runtime exception if it is not found.
|
<T extends Serializable> |
cookiepack(String name,
T defaultValue)
Returns the value of the specified cookie-persisted session attribute from the HTTP request, or the
specified default value, if it is not found.
|
Map<String,String> |
cookies()
Gets the cookies of the HTTP request.
|
Map<String,Object> |
data()
Gets the data parameters (URL parameters + posted parameters + posted files) of the HTTP request.
|
<T> T |
data(String name)
Returns the value of the specified data parameter from the HTTP request, or throws a runtime exception if
it is not found.
|
<T> T |
data(String name,
T defaultValue)
Returns the value of the specified data parameter from the HTTP request, or the specified default value,
if it is not found.
|
Req |
done()
Informs the HTTP server that the asynchronous handling has finished and the response is complete.
|
byte[] |
file(String name)
Returns the content of the posted file from the HTTP request body, or throws a runtime exception if it is
not found.
|
byte[] |
file(String name,
byte[] defaultValue)
Returns the content of the posted file from the HTTP request body, or the specified default value, if it
is not found.
|
Map<String,byte[]> |
files()
Gets the posted files from the HTTP request body.
|
boolean |
hasCookiepack()
Does the HTTP request have a cookie-persisted session attached?
|
boolean |
hasSession()
Does the HTTP request have a server-side session attached?
|
String |
header(String name)
Returns the value of the specified header from the HTTP request, or throws a runtime exception if it is
not found.
|
String |
header(String name,
String defaultValue)
Returns the value of the specified header from the HTTP request, or the specified default value, if it is
not found.
|
Map<String,String> |
headers()
Gets the headers of the HTTP request.
|
String |
host()
Gets the value of the Host header of the HTTP request.
|
Req |
host(String host)
Sets the value of the Host header of the HTTP request.
|
boolean |
isAsync()
Is/was the request being handled in asynchronous mode?
|
boolean |
isDone()
Has the request handling and response construction finished?
|
OutputStream |
out()
Renders the response headers based on the response() object, and then returns an OutputStream representing
the response body.
|
String |
param(String name)
Returns the value of the specified mandatory URL parameter from the HTTP request, or throws a runtime
exception if it is not found.
|
String |
param(String name,
String defaultValue)
Returns the value of the specified optional URL parameter from the HTTP request, or the specified default
value, if not found.
|
Map<String,String> |
params()
Gets the URL parameters of the HTTP request.
|
String |
path()
Gets the path of the HTTP request.
|
Req |
path(String path)
Sets the path of the HTTP request.
|
Map<String,Object> |
posted()
Gets the posted parameters of the HTTP request body.
|
<T extends Serializable> |
posted(String name)
Returns the value of the specified posted parameter from the HTTP request body, or throws a runtime
exception if it is not found.
|
<T extends Serializable> |
posted(String name,
T defaultValue)
Returns the value of the specified posted parameter from the HTTP request body, or the specified default
value, if it is not found.
|
String |
query()
Gets the query of the HTTP request.
|
Req |
query(String query)
Sets the query of the HTTP request.
|
long |
requestId()
Gets the HTTP request ID, which is unique per HTTP server instance.
|
Resp |
response()
Gets the reference to the response object.
|
Map<String,Serializable> |
session()
Gets the server-side session attributes of the HTTP request.
|
<T extends Serializable> |
session(String name)
Returns the value of the specified server-side session attribute from the HTTP request, or throws a
runtime exception if it is not found.
|
<T extends Serializable> |
session(String name,
T defaultValue)
Returns the value of the specified server-side session attribute from the HTTP request, or the specified
default value, if it is not found.
|
String |
sessionId()
Returns the ID of the session (the value of the "JSESSIONID" cookie).
|
String |
uri()
Gets the uri of the HTTP request.
|
Req |
uri(String uri)
Sets the uri of the HTTP request.
|
String |
verb()
Gets the verb of the HTTP request.
|
Req |
verb(String verb)
Sets the verb of the HTTP request.
|
String verb()
String uri()
String path()
String query()
byte[] body()
Req body(byte[] body)
String host()
String clientIpAddress()
long connectionId()
long requestId()
String param(String name)
String param(String name, String defaultValue)
<T extends Serializable> T posted(String name)
<T extends Serializable> T posted(String name, T defaultValue)
byte[] file(String name)
byte[] file(String name, byte[] defaultValue)
Map<String,Object> data()
<T> T data(String name)
<T> T data(String name, T defaultValue)
<T> T attr(String name)
<T> T attr(String name, T defaultValue)
String sessionId()
boolean hasSession()
Map<String,Serializable> session()
<T extends Serializable> T session(String name)
<T extends Serializable> T session(String name, T defaultValue)
boolean hasCookiepack()
Map<String,Serializable> cookiepack()
<T extends Serializable> T cookiepack(String name)
<T extends Serializable> T cookiepack(String name, T defaultValue)
String header(String name)
String header(String name, String defaultValue)
String cookie(String name)
String cookie(String name, String defaultValue)
Resp response()
OutputStream out()
Req async()
Req#done() or Resp#done() method must be called, to
inform the server.boolean isAsync()
Req done()
boolean isDone()
Copyright © 2014–2015 Nikolche Mihajlovski and contributors. All rights reserved.