public interface Request
| Modifier and Type | Method and Description |
|---|---|
Auth |
auth()
Returns the auth.
|
java.lang.String |
baseUrl()
Returns the base URL corresponding to the the HTTP request.
|
java.lang.String |
body()
Returns the body content as a string.
|
Request |
body(byte[] body)
Sets the raw body content.
|
Request |
body(java.lang.Object body)
Sets the body content, assuming JSON content type.
|
Request |
body(java.lang.String body)
Sets the body content by passing the string value.
|
Request |
body(java.lang.String body,
ContentType contentType)
Sets the raw body content and the
content-type. |
byte[] |
bodyBytes()
Returns the raw body content.
|
<T> java.util.List<T> |
bodyList(java.lang.Class<T> componentType)
Returns parsed
body content as a List. |
<K,V> java.util.Map<K,V> |
bodyMap(java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Returns parsed
body content. |
default <V> java.util.Map<java.lang.String,V> |
bodyMap(java.lang.Class<V> valueType)
REturns parsed
body content. |
<T> T |
bodyValue()
Parses the body depending on content-type.
|
<T> T |
bodyValue(java.lang.Class<T> type)
Parses the body depending on content-type into the target type.
|
java.lang.String |
contentType()
Gets the content type header.
|
Request |
contentType(ContentType contentType)
Sets the content type header.
|
Context |
context()
Returns the context that this request belongs to.
|
Request |
cookie(Cookie cookie)
Adds a cookie to the response.
|
Cookie |
cookie(java.lang.String name)
Gets cookie value by name.
|
java.util.Map<java.lang.String,Cookie> |
cookies() |
FileUpload[] |
fileUploads()
Returns array of uploaded files.
|
java.lang.Object |
form(java.lang.String name)
Returns the form parameter.
|
Request |
form(java.lang.String name,
java.lang.Object value)
Sets the form parameter.
|
MultiMap<java.lang.Object> |
forms()
Returns form parameters.
|
java.lang.String |
header(java.lang.String name)
Gets header value by name.
|
Request |
header(java.lang.String name,
java.lang.String value)
Sets the first header name with the specified value.
|
MultiMap<java.lang.String> |
headers()
Returns headers.
|
boolean |
isContentType(ContentType contentType)
Checks if the request contains a content type header with the
specified value.
|
java.lang.String |
method()
Returns HTTP method, in uppercase.
|
Request |
method(java.lang.String method)
Sets method.
|
void |
next()
Delegates this request to the next handler.
|
void |
next(OnResponseEndCallback onResponseEnd)
Delegates this request to the next handler and executes
the runnable on the response end.
|
java.lang.String |
param(java.lang.String name)
Gets parameter value by name.
|
Request |
param(java.lang.String name,
java.lang.String value)
Sets parameter value.
|
MultiMap<java.lang.String> |
params()
Returns map of string request parameters.
|
java.lang.String |
path()
Returns action path of the URI.
|
java.lang.String |
query()
Returns the query string of the URL.
|
Response |
response()
Returns associated response of this request.
|
void |
response(Response response)
Associates response to this request.
|
Session |
session()
Returns current session.
|
java.lang.String |
url()
Returns the absolute URL corresponding to the the HTTP request.
|
MultiMap<java.lang.Object> |
values()
Merges all the inputs in best possible way.
|
<T> T |
values(java.lang.Class<T> type)
Returns merged values to a certain type.
|
Auth auth()
java.lang.String baseUrl()
null the request represents a 'local' call,
with only a path() existing.java.lang.String body()
Request body(byte[] body)
Request body(java.lang.Object body)
Request body(java.lang.String body)
Request body(java.lang.String body, ContentType contentType)
content-type.
This is just a shortcut method.byte[] bodyBytes()
<T> java.util.List<T> bodyList(java.lang.Class<T> componentType)
body content as a List.<K,V> java.util.Map<K,V> bodyMap(java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
body content.
If body is not set, returns null.default <V> java.util.Map<java.lang.String,V> bodyMap(java.lang.Class<V> valueType)
body content.
If body is not set, returns null.<T> T bodyValue()
body content.
If body is not set, returns null.
If body can not be parsed, throws an Exception.<T> T bodyValue(java.lang.Class<T> type)
bodyValue()java.lang.String contentType()
Request contentType(ContentType contentType)
Context context()
java.util.Map<java.lang.String,Cookie> cookies()
Cookie cookie(java.lang.String name)
FileUpload[] fileUploads()
null if nothing
was uploaded.java.lang.Object form(java.lang.String name)
Request form(java.lang.String name, java.lang.Object value)
MultiMap<java.lang.Object> forms()
java.lang.String header(java.lang.String name)
Request header(java.lang.String name, java.lang.String value)
MultiMap<java.lang.String> headers()
boolean isContentType(ContentType contentType)
java.lang.String method()
Request method(java.lang.String method)
void next()
void next(OnResponseEndCallback onResponseEnd)
java.lang.String param(java.lang.String name)
Request param(java.lang.String name, java.lang.String value)
MultiMap<java.lang.String> params()
Parameters are accumulated in given order.
java.lang.String path()
"/" for the root.java.lang.String query()
Response response()
void response(Response response)
Session session()
java.lang.String url()
MultiMap<java.lang.Object> values()
parameters - parsed to a JSON, if possiblebodyValue() parsed body}null.
When content type is one of the form content types, body is ignored.<T> T values(java.lang.Class<T> type)
values()