| Constructor and Description |
|---|
RequestWrapper(Request 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. |
<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.
|
protected final Request request
public RequestWrapper(Request request)
public java.lang.String baseUrl()
Requestnull the request represents a 'local' call,
with only a Request.path() existing.public java.lang.String body()
Requestpublic Request body(byte[] body)
Requestpublic Request body(java.lang.Object body)
Requestpublic Request body(java.lang.String body)
Requestpublic Request body(java.lang.String body, ContentType contentType)
Requestcontent-type.
This is just a shortcut method.public byte[] bodyBytes()
Requestpublic <T> java.util.List<T> bodyList(java.lang.Class<T> componentType)
Requestbody content as a List.public <K,V> java.util.Map<K,V> bodyMap(java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Requestbody content.
If body is not set, returns null.public <V> java.util.Map<java.lang.String,V> bodyMap(java.lang.Class<V> valueType)
Requestbody content.
If body is not set, returns null.public <T> T bodyValue()
Requestbody content.
If body is not set, returns null.
If body can not be parsed, throws an Exception.public <T> T bodyValue(java.lang.Class<T> type)
RequestbodyValue in interface RequestRequest.bodyValue()public java.lang.String contentType()
RequestcontentType in interface Requestpublic Request contentType(ContentType contentType)
RequestcontentType in interface Requestpublic Context context()
Requestpublic Request cookie(Cookie cookie)
Requestpublic Cookie cookie(java.lang.String name)
Requestpublic java.util.Map<java.lang.String,Cookie> cookies()
public FileUpload[] fileUploads()
Requestnull if nothing
was uploaded.fileUploads in interface Requestpublic java.lang.Object form(java.lang.String name)
Requestpublic Request form(java.lang.String name, java.lang.Object value)
Requestpublic MultiMap<java.lang.Object> forms()
Requestpublic java.lang.String header(java.lang.String name)
Requestpublic Request header(java.lang.String name, java.lang.String value)
Requestpublic MultiMap<java.lang.String> headers()
Requestpublic boolean isContentType(ContentType contentType)
RequestisContentType in interface Requestpublic java.lang.String method()
Requestpublic Request method(java.lang.String method)
Requestpublic void next()
Requestpublic void next(OnResponseEndCallback onResponseEnd)
Requestpublic java.lang.String param(java.lang.String name)
Requestpublic Request param(java.lang.String name, java.lang.String value)
Requestpublic MultiMap<java.lang.String> params()
RequestParameters are accumulated in given order.
public java.lang.String path()
Request"/" for the root.public java.lang.String query()
Requestpublic Response response()
Requestpublic void response(Response response)
Requestpublic Session session()
Requestpublic java.lang.String url()
Requestpublic MultiMap<java.lang.Object> values()
Requestparameters - parsed to a JSON, if possibleRequest.bodyValue() parsed body}null.
When content type is one of the form content types, body is ignored.public <T> T values(java.lang.Class<T> type)
Requestvalues in interface RequestRequest.values()