Response.Status| Constructor and Description |
|---|
ResponseWrapper(Response response) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
body()
Returns body content.
|
Response |
body(byte[] body)
Sets the raw body content.
|
Response |
body(java.lang.Object body)
Sets the JSON body content.
|
Response |
body(java.lang.String body)
Sets the body content.
|
Response |
body(java.lang.String body,
ContentType contentType)
Sets the body content and common
content-type. |
byte[] |
bodyBytes()
Returns the raw body content.
|
<T> java.util.List<T> |
bodyList(java.lang.Class<T> componentType)
Returns parsed
body content. |
<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()
Returns parsed
body content. |
<T> T |
bodyValue(java.lang.Class<T> type)
Returns parsed
body content. |
java.lang.String |
contentType()
Gets the content type header.
|
Response |
contentType(ContentType contentType)
Sets the content type header.
|
Context |
context()
Returns the context that this response belongs to.
|
Response |
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() |
void |
end()
Closes the response.
|
void |
end(java.lang.Object body)
Sets the body and clsoes the response.
|
void |
end(java.lang.String body)
Sets the body content and closes the response.
|
void |
end(java.lang.String body,
ContentType contentType)
Sets the body content and common
content-type
and closes the response. |
java.lang.String |
header(java.lang.String name)
Gets header value by name.
|
Response |
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 |
isCommitted()
Returns
true if response is already committed. |
boolean |
isContentType(ContentType contentType)
Checks if the response contains a content type header with the specified value.
|
Response |
pipe(Response response)
Pipes response to another response and ends it.
|
void |
redirect(java.lang.String url)
Redirects response to an url.
|
Request |
request()
Returns associated request of this response.
|
Session |
session()
Returns current session.
|
Response |
status(int statusCode)
Sets the response status code and default status message.
|
Response |
status(int statusCode,
java.lang.String statusMessage)
Sets the response status code and message.
|
int |
statusCode()
Returns status code.
|
java.lang.String |
statusMessage()
Returns status message.
|
boolean |
succeeded()
Checks if response succeeded.
|
protected final Response response
public ResponseWrapper(Response response)
public java.lang.String body()
Responsepublic Response body(byte[] body)
Responsepublic Response body(java.lang.Object body)
Responsepublic Response body(java.lang.String body)
Responsepublic Response body(java.lang.String body, ContentType contentType)
Responsecontent-type.
Just a shortcut call.public byte[] bodyBytes()
Responsepublic <T> java.util.List<T> bodyList(java.lang.Class<T> componentType)
Responsebody content.
If body is not set, returns null.public <K,V> java.util.Map<K,V> bodyMap(java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Responsebody content.
If body is not set, returns null.public <V> java.util.Map<java.lang.String,V> bodyMap(java.lang.Class<V> valueType)
Responsebody content.
If body is not set, returns null.public <T> T bodyValue()
Responsebody content.
If body is not set, returns null.public <T> T bodyValue(java.lang.Class<T> type)
Responsebody content.
If body is not set, returns null.public java.lang.String contentType()
ResponsecontentType in interface Responsepublic Response contentType(ContentType contentType)
ResponsecontentType in interface Responsepublic Context context()
Responsepublic Response cookie(Cookie cookie)
Responsepublic Cookie cookie(java.lang.String name)
Responsepublic java.util.Map<java.lang.String,Cookie> cookies()
public void end()
Responsebody(null).public void end(java.lang.Object body)
Responsepublic void end(java.lang.String body)
Responsepublic void end(java.lang.String body,
ContentType contentType)
Responsecontent-type
and closes the response.public java.lang.String header(java.lang.String name)
Responsepublic Response header(java.lang.String name, java.lang.String value)
Responsepublic MultiMap<java.lang.String> headers()
Responsepublic boolean isCommitted()
Responsetrue if response is already committed.isCommitted in interface Responsepublic boolean isContentType(ContentType contentType)
ResponseisContentType in interface Responsepublic Response pipe(Response response)
Responsepublic void redirect(java.lang.String url)
Responsepublic Request request()
Responsepublic Session session()
Responsepublic Response status(int statusCode)
Responsepublic Response status(int statusCode, java.lang.String statusMessage)
Responsepublic int statusCode()
ResponsestatusCode in interface Responsepublic java.lang.String statusMessage()
ResponsestatusMessage in interface Response