public class Result extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
APPLICATION_OCTET_STREAM |
static String |
APPLICATION_XML |
static String |
APPLICATON_JSON |
static String |
CACHE_CONTROL |
static String |
CACHE_CONTROL_DEFAULT_NOCACHE_VALUE |
static String |
DATE |
static String |
EXPIRES |
static String |
LOCATION |
static int |
SC_200_OK |
static int |
SC_204_NO_CONTENT |
static int |
SC_300_MULTIPLE_CHOICES |
static int |
SC_301_MOVED_PERMANENTLY |
static int |
SC_302_FOUND |
static int |
SC_303_SEE_OTHER |
static int |
SC_304_NOT_MODIFIED |
static int |
SC_307_TEMPORARY_REDIRECT |
static int |
SC_400_BAD_REQUEST |
static int |
SC_403_FORBIDDEN |
static int |
SC_404_NOT_FOUND |
static int |
SC_500_INTERNAL_SERVER_ERROR |
static int |
SC_501_NOT_IMPLEMENTED |
static String |
TEXT_HTML |
static String |
TEXT_PLAIN |
| Constructor and Description |
|---|
Result(int statusCode)
A result.
|
| Modifier and Type | Method and Description |
|---|---|
Result |
addCookie(Cookie cookie) |
Result |
addHeader(String headerName,
String headerContent) |
void |
charset(String charset) |
Result |
contentType(String contentType)
Sets the content type.
|
Result |
doNotCacheContent()
This function sets
Cache-Control: no-cache, no-store
Date: (current date)
Expires: 1970
=> it therefore effectively forces the browser and every proxy in between
not to cache content.
|
String |
getCharset() |
String |
getContentType() |
Cookie |
getCookie(String cookieName)
Returns cookie with that name or null.
|
List<Cookie> |
getCookies() |
Map<String,String> |
getHeaders() |
Object |
getRenderable() |
int |
getStatusCode() |
String |
getTemplate() |
Result |
html()
Set the content type of this result to
TEXT_HTML. |
Result |
json()
Set the content type of this result to
APPLICATON_JSON. |
Result |
redirect(String url)
A redirect that uses 303 see other.
|
Result |
redirectTemporary(String url)
A redirect that uses 307 see other.
|
Result |
render(Object renderable) |
Result |
setContentType(String contentType)
Deprecated.
|
Result |
status(int statusCode)
Set the status of this result.
|
Result |
template(String template)
Set the template to render.
|
Result |
unsetCookie(String name) |
Result |
xml()
Set the content type of this result to
Result#APPLICATON_XML. |
public static int SC_200_OK
public static int SC_204_NO_CONTENT
public static int SC_300_MULTIPLE_CHOICES
public static int SC_301_MOVED_PERMANENTLY
public static int SC_302_FOUND
public static int SC_303_SEE_OTHER
public static int SC_304_NOT_MODIFIED
public static int SC_307_TEMPORARY_REDIRECT
public static int SC_400_BAD_REQUEST
public static int SC_403_FORBIDDEN
public static int SC_404_NOT_FOUND
public static int SC_500_INTERNAL_SERVER_ERROR
public static int SC_501_NOT_IMPLEMENTED
public static final String TEXT_HTML
public static final String TEXT_PLAIN
public static final String APPLICATON_JSON
public static final String APPLICATION_XML
public static final String APPLICATION_OCTET_STREAM
public static final String LOCATION
public static final String CACHE_CONTROL
public static final String CACHE_CONTROL_DEFAULT_NOCACHE_VALUE
public static final String DATE
public static final String EXPIRES
public Result(int statusCode)
SC_200_OK, SC_204_NO_CONTENT and so on
for some short cuts to predefined results.statusCode - The status code to set for the result. Shortcuts to the code at: SC_200_OKpublic Object getRenderable()
public String getContentType()
public String getCharset()
public void charset(String charset)
@Deprecated public Result setContentType(String contentType)
contentType - public Result contentType(String contentType)
charset(String);contentType - (without encoding) something like "text/html" or
"application/json"public Cookie getCookie(String cookieName)
cookieName - Name of the cookiepublic int getStatusCode()
public Result status(int statusCode)
SC_200_OK, SC_204_NO_CONTENT and so on
for some short cuts to predefined results.statusCode - The status code. Result (SC_200_OK) provides some helpers.public String getTemplate()
public Result template(String template)
template - The view to render. Eg. views/AnotherController/anotherview.ftl.htmlpublic Result redirect(String url)
url - The url used as redirect target.public Result redirectTemporary(String url)
url - The url used as redirect target.public Result html()
TEXT_HTML.TEXT_HTML.public Result json()
APPLICATON_JSON.APPLICATON_JSON.public Result xml()
Result#APPLICATON_XML.Result#APPLICATON_XML.public Result doNotCacheContent()
Copyright © 2013. All Rights Reserved.