public class HttpResponses extends Object
HttpResponse
.Modifier and Type | Class and Description |
---|---|
static class |
HttpResponses.HttpResponseException |
Constructor and Description |
---|
HttpResponses() |
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, String errorMessage)
errorWithoutStack(int, java.lang.String)
public static HttpResponses.HttpResponseException error(Throwable cause)
public static HttpResponses.HttpResponseException error(int code, Throwable cause)
public static HttpResponses.HttpResponseException errorWithoutStack(int code, String errorMessage)
error(int, String)
public static HttpResponses.HttpResponseException redirectViaContextPath(String relative)
public static HttpResponses.HttpResponseException redirectViaContextPath(int statusCode, String relative)
relative
- The path relative to the context path. The context path + this value
is sent to the user.public static HttpRedirect redirectTo(String url)
url
- The URL to redirect to. If relative, relative to the page currently being served.public static HttpRedirect redirectTo(int statusCode, String url)
public static HttpResponse redirectToDot()
public static HttpResponses.HttpResponseException redirectToContextRoot()
public static HttpResponses.HttpResponseException forwardToPreviousPage()
public static HttpResponse staticResource(URL resource)
staticResource(resource,0)
public static HttpResponse staticResource(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(String literalHtml)
public static HttpResponse plainText(String plainText)
public static ForwardToView forwardToView(Object it, String view)
public static ForwardToView forwardToView(Class clazz, String view)
Copyright © 2014. All rights reserved.