コード例 #1
0
 public static Response rangeNotSatisfiable(final long contentSize) {
   return new Response.Builder()
       .status(Status.failure(REQUESTED_RANGE_NOT_SATISFIABLE))
       .header(HttpHeaders.CONTENT_LENGTH, "0")
       .header(HttpHeaders.CONTENT_RANGE, "bytes */" + contentSize)
       .build();
 }
コード例 #2
0
 public static Response methodNotAllowed(final String methodName, final String... allowedMethods) {
   checkNotNull(methodName);
   checkNotNull(allowedMethods);
   checkArgument(allowedMethods.length != 0);
   return new Response.Builder()
       .status(Status.failure(METHOD_NOT_ALLOWED, methodName))
       .header(HttpHeaders.ALLOW, Joiner.on(',').join(allowedMethods))
       .build();
 }
コード例 #3
0
 public static Response unauthorized(final @Nullable String message) {
   return new Response.Builder().status(Status.failure(UNAUTHORIZED, message)).build();
 }
コード例 #4
0
 public static Response badRequest(final @Nullable String message) {
   return new Response.Builder().status(Status.failure(BAD_REQUEST, message)).build();
 }
コード例 #5
0
 public static Response notFound(final @Nullable String message) {
   return new Response.Builder().status(Status.failure(NOT_FOUND, message)).build();
 }
コード例 #6
0
 public static Response noContent(final @Nullable String message) {
   return new Response.Builder().status(Status.success(NO_CONTENT, message)).build();
 }
コード例 #7
0
 public static Response created(final Payload payload) {
   return new Response.Builder().status(Status.success(CREATED)).payload(payload).build();
 }
コード例 #8
0
 public static Response created(final @Nullable String message) {
   return new Response.Builder().status(Status.success(CREATED, message)).build();
 }
コード例 #9
0
 public static Response ok(final Payload payload) {
   return new Response.Builder().status(Status.success(OK)).payload(payload).build();
 }
コード例 #10
0
 public static Response ok(final @Nullable String message) {
   return new Response.Builder().status(Status.success(OK, message)).build();
 }
コード例 #11
0
 public static Response notImplemented(final @Nullable String message) {
   return new Response.Builder().status(Status.failure(NOT_IMPLEMENTED, message)).build();
 }
コード例 #12
0
 public static Response badGateway(final @Nullable String message) {
   return new Response.Builder().status(Status.failure(BAD_GATEWAY, message)).build();
 }
コード例 #13
0
 public static Response serviceUnavailable(final @Nullable String message) {
   return new Response.Builder().status(Status.failure(SERVICE_UNAVAILABLE, message)).build();
 }
コード例 #14
0
 public static Response forbidden(final @Nullable String message) {
   return new Response.Builder().status(Status.failure(FORBIDDEN, message)).build();
 }