예제 #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();
 }