public abstract class Response<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Response.Accepted
Accepted as task for asynchronous execution.
|
static class |
Response.Redirect
An HTTP redirect to another location.
|
Constructor and Description |
---|
Response() |
Modifier and Type | Method and Description |
---|---|
static Response.Accepted |
accepted(java.lang.String location)
HTTP 202 Accepted: accepted as background task.
|
abstract CacheControl |
caching() |
abstract Response<T> |
caching(CacheControl c) |
static <T> Response<T> |
created(T value)
HTTP 201 Created: typically used when a new resource is made.
|
abstract boolean |
isNone() |
static <T> Response<T> |
none()
HTTP 204 No Content: typically used when the resource is deleted.
|
static <T> Response<T> |
ok(T value)
HTTP 200 OK: pointless wrapper for type safety.
|
static Response.Redirect |
redirect(java.lang.String location)
HTTP 302 Found: temporary redirect to another URL.
|
abstract int |
statusCode() |
abstract java.lang.String |
toString() |
static <T> T |
unwrap(T obj) |
abstract T |
value() |
static <T> Response<T> |
withMustRevalidate(T value) |
static <T> Response<T> |
withStatusCode(int statusCode,
T value)
Arbitrary status code with wrapped result.
|
public static <T> Response<T> ok(T value)
public static <T> Response<T> withMustRevalidate(T value)
public static <T> Response<T> created(T value)
public static Response.Accepted accepted(java.lang.String location)
public static <T> Response<T> none()
public static Response.Redirect redirect(java.lang.String location)
public static <T> Response<T> withStatusCode(int statusCode, T value)
public static <T> T unwrap(T obj)
public abstract boolean isNone()
public abstract int statusCode()
public abstract T value()
public abstract CacheControl caching()
public abstract Response<T> caching(CacheControl c)
public abstract java.lang.String toString()
toString
in class java.lang.Object