Class Response<T>
java.lang.Object
com.google.gerrit.extensions.restapi.Response<T>
- Direct Known Subclasses:
Response.Accepted,Response.Redirect
Special return value to mean specific HTTP status codes in a REST API.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAccepted as task for asynchronous execution.static final classAn HTTP redirect to another location. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Response.AcceptedHTTP 202 Accepted: accepted as background task.abstract CacheControlcaching()created()HTTP 201 Created: with empty value.static <T> Response<T> created(T value) HTTP 201 Created: typically used when a new resource is made.headers()abstract booleanisNone()static <T> Response<T> none()HTTP 204 No Content: typically used when the resource is deleted.ok()HTTP 200 OK: with empty value.static <T> Response<T> ok(T value) HTTP 200 OK: pointless wrapper for type safety.static <T> Response<T> static Response.RedirectHTTP 302 Found: temporary redirect to another URL.abstract intabstract StringtoString()static <T> Tunwrap(T obj) abstract Tvalue()static <T> Response<T> withMustRevalidate(T value) HTTP 200 OK: with forced revalidation of cache.static <T> Response<T> withStatusCode(int statusCode, T value) Arbitrary status code with wrapped result.
-
Constructor Details
-
Response
public Response()
-
-
Method Details
-
ok
HTTP 200 OK: pointless wrapper for type safety. -
ok
-
ok
HTTP 200 OK: with empty value. -
withMustRevalidate
HTTP 200 OK: with forced revalidation of cache. -
created
HTTP 201 Created: typically used when a new resource is made. -
created
HTTP 201 Created: with empty value. -
accepted
HTTP 202 Accepted: accepted as background task. -
none
HTTP 204 No Content: typically used when the resource is deleted. -
redirect
HTTP 302 Found: temporary redirect to another URL. -
withStatusCode
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
-
headers
-
caching
-
caching
-
toString
-