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(); }
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(); }
public static Response unauthorized(final @Nullable String message) { return new Response.Builder().status(Status.failure(UNAUTHORIZED, message)).build(); }
public static Response badRequest(final @Nullable String message) { return new Response.Builder().status(Status.failure(BAD_REQUEST, message)).build(); }
public static Response notFound(final @Nullable String message) { return new Response.Builder().status(Status.failure(NOT_FOUND, message)).build(); }
public static Response noContent(final @Nullable String message) { return new Response.Builder().status(Status.success(NO_CONTENT, message)).build(); }
public static Response created(final Payload payload) { return new Response.Builder().status(Status.success(CREATED)).payload(payload).build(); }
public static Response created(final @Nullable String message) { return new Response.Builder().status(Status.success(CREATED, message)).build(); }
public static Response ok(final Payload payload) { return new Response.Builder().status(Status.success(OK)).payload(payload).build(); }
public static Response ok(final @Nullable String message) { return new Response.Builder().status(Status.success(OK, message)).build(); }
public static Response notImplemented(final @Nullable String message) { return new Response.Builder().status(Status.failure(NOT_IMPLEMENTED, message)).build(); }
public static Response badGateway(final @Nullable String message) { return new Response.Builder().status(Status.failure(BAD_GATEWAY, message)).build(); }
public static Response serviceUnavailable(final @Nullable String message) { return new Response.Builder().status(Status.failure(SERVICE_UNAVAILABLE, message)).build(); }
public static Response forbidden(final @Nullable String message) { return new Response.Builder().status(Status.failure(FORBIDDEN, message)).build(); }