Class Response<T>

java.lang.Object
com.google.gerrit.extensions.restapi.Response<T>
Direct Known Subclasses:
Response.Accepted, Response.Redirect

public abstract class Response<T> extends Object
Special return value to mean specific HTTP status codes in a REST API.
  • Constructor Details

    • Response

      public Response()
  • Method Details

    • ok

      public static <T> Response<T> ok(T value)
      HTTP 200 OK: pointless wrapper for type safety.
    • ok

      public static <T> Response<T> ok(T value, com.google.common.collect.ImmutableMultimap<String,String> headers)
    • ok

      public static Response<String> ok()
      HTTP 200 OK: with empty value.
    • withMustRevalidate

      public static <T> Response<T> withMustRevalidate(T value)
      HTTP 200 OK: with forced revalidation of cache.
    • created

      public static <T> Response<T> created(T value)
      HTTP 201 Created: typically used when a new resource is made.
    • created

      public static Response<String> created()
      HTTP 201 Created: with empty value.
    • 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()
    • headers

      public abstract com.google.common.collect.ImmutableMultimap<String,String> headers()
    • caching

      public abstract CacheControl caching()
    • caching

      public abstract Response<T> caching(CacheControl c)
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object