public class HttpResponses
extends java.lang.Object
HttpResponse
.Modifier and Type | Class and Description |
---|---|
static class |
HttpResponses.HttpResponseException |
Constructor and Description |
---|
HttpResponses() |
Modifier and Type | Method and Description |
---|---|
static HttpResponses.HttpResponseException |
error(int code,
java.lang.String errorMessage) |
static HttpResponses.HttpResponseException |
error(int code,
java.lang.Throwable cause) |
static HttpResponses.HttpResponseException |
forbidden() |
static HttpResponses.HttpResponseException |
forwardToPreviousPage()
Redirects the user back to where he came from.
|
static ForwardToView |
forwardToView(java.lang.Class clazz,
java.lang.String view) |
static ForwardToView |
forwardToView(java.lang.Object it,
java.lang.String view) |
static HttpResponse |
html(java.lang.String literalHtml)
Serves the literal HTML.
|
static HttpResponses.HttpResponseException |
notFound() |
static HttpResponses.HttpResponseException |
ok() |
static HttpResponse |
plainText(java.lang.String plainText)
Serves the plain text.
|
static HttpRedirect |
redirectTo(java.lang.String url) |
static HttpResponses.HttpResponseException |
redirectToContextRoot()
Redirect to the context root
|
static HttpResponse |
redirectToDot()
Redirect to "."
|
static HttpResponses.HttpResponseException |
redirectViaContextPath(java.lang.String relative) |
static HttpResponse |
staticResource(java.net.URL resource)
Serves a static resource specified by the URL.
|
static HttpResponse |
staticResource(java.net.URL resource,
long expiration)
Serves a static resource specified by the URL.
|
static HttpResponses.HttpResponseException |
status(int code) |
public static HttpResponses.HttpResponseException ok()
public static HttpResponses.HttpResponseException notFound()
public static HttpResponses.HttpResponseException forbidden()
public static HttpResponses.HttpResponseException status(int code)
public static HttpResponses.HttpResponseException error(int code, java.lang.String errorMessage)
public static HttpResponses.HttpResponseException error(int code, java.lang.Throwable cause)
public static HttpResponses.HttpResponseException redirectViaContextPath(java.lang.String relative)
relative
- The path relative to the context path. The context path + this value
is sent to the user.public static HttpRedirect redirectTo(java.lang.String url)
url
- The URL to redirect to. If relative, relative to the page currently being served.public static HttpResponse redirectToDot()
public static HttpResponses.HttpResponseException redirectToContextRoot()
public static HttpResponses.HttpResponseException forwardToPreviousPage()
public static HttpResponse staticResource(java.net.URL resource)
staticResource(resource,0)
public static HttpResponse staticResource(java.net.URL resource, long expiration)
resource
- The static resource to be served.expiration
- The number of milliseconds until the resource will "expire".
Until it expires the browser will be allowed to cache it
and serve it without checking back with the server.
After it expires, the client will send conditional GET to
check if the resource is actually modified or not.
If 0, it will immediately expire.public static HttpResponse html(java.lang.String literalHtml)
public static HttpResponse plainText(java.lang.String plainText)
public static ForwardToView forwardToView(java.lang.Object it, java.lang.String view)
public static ForwardToView forwardToView(java.lang.Class clazz, java.lang.String view)
Copyright © 2013. All Rights Reserved.