Class Response<T>
- java.lang.Object
-
- com.google.gerrit.extensions.restapi.Response<T>
-
public abstract class Response<T> extends Object
Special return value to mean specific HTTP status codes in a REST API.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResponse.AcceptedAccepted as task for asynchronous execution.static classResponse.RedirectAn HTTP redirect to another location.
-
Constructor Summary
Constructors Constructor Description Response()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Response.Acceptedaccepted(String location)HTTP 202 Accepted: accepted as background task.abstract CacheControlcaching()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 booleanisNone()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.Redirectredirect(String location)HTTP 302 Found: temporary redirect to another URL.abstract intstatusCode()abstract StringtoString()static <T> Tunwrap(T obj)abstract Tvalue()static <T> Response<T>withMustRevalidate(T value)static <T> Response<T>withStatusCode(int statusCode, T value)Arbitrary status code with wrapped result.
-
-
-
Method Detail
-
ok
public static <T> Response<T> ok(T value)
HTTP 200 OK: pointless wrapper for type safety.
-
withMustRevalidate
public static <T> Response<T> withMustRevalidate(T value)
-
created
public static <T> Response<T> created(T value)
HTTP 201 Created: typically used when a new resource is made.
-
accepted
public static Response.Accepted accepted(String location)
HTTP 202 Accepted: accepted as background task.
-
none
public static <T> Response<T> none()
HTTP 204 No Content: typically used when the resource is deleted.
-
redirect
public static Response.Redirect redirect(String location)
HTTP 302 Found: temporary redirect to another URL.
-
withStatusCode
public static <T> Response<T> withStatusCode(int statusCode, T value)
Arbitrary status code with wrapped result.
-
unwrap
public static <T> T unwrap(T obj)
-
isNone
public abstract boolean isNone()
-
statusCode
public abstract int statusCode()
-
value
public abstract T value()
-
caching
public abstract CacheControl caching()
-
caching
public abstract Response<T> caching(CacheControl c)
-
-