public class ResponseUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static Response |
alreadyReportedResponse()
Returns a "208 Already reported" response.
|
static Response |
elementNotFoundResponse()
Returns a "404 Element not found" response.
|
static Response |
htmlOkResponse(java.lang.String html)
Returns a 200 OK response containing the provided html .
|
static Response |
htmlResponse(java.lang.String html,
Response.Status status)
Returns a response containing the provided html with the provided status .
|
static Response |
jsonOkResponse(JSONArray jsonArray)
Returns a 200 OK response containing the provided
JSONArray . |
static Response |
jsonOkResponse(JSONObject jsonObject)
Returns a 200 OK response containing the provided
JSONObject . |
static Response |
jsonOkResponse(Message protoMessage)
Returns a 200 OK response containing a JSON representation of the provided protobuf
Message . |
static Response |
jsonResponse(JSONArray jsonArray,
Response.Status status)
Returns a response containing the provided
JSONArray . |
static Response |
jsonResponse(JSONObject jsonObject,
Response.Status status)
Returns a 200 OK response containing the provided
JSONObject . |
static Response |
jsonResponse(Message protoMessage,
Response.Status status)
Returns a 200 OK response containing a JSON representation of the provided protobuf
Message . |
static Response |
jsonResponseBean(java.lang.Object entity,
Response.Status status)
Returns a 200 OK response containing the provided JSON
String . |
static Response |
plainOkResponse(java.lang.String plaintext)
Returns a 200 OK response containing the provided plaintext
String . |
static Response |
plainResponse(java.lang.String plaintext,
int statusCode)
Returns a response containing the provided plaintext
String with the
provided statusCode. |
static Response |
plainResponse(java.lang.String plaintext,
Response.Status status)
Returns a response containing the provided plaintext
String with the
provided status Response.Status . |
public static Response jsonOkResponse(JSONArray jsonArray)
JSONArray
.public static Response jsonResponse(JSONArray jsonArray, Response.Status status)
JSONArray
.public static Response jsonOkResponse(JSONObject jsonObject)
JSONObject
.public static Response jsonResponse(JSONObject jsonObject, Response.Status status)
JSONObject
.public static Response jsonOkResponse(Message protoMessage)
Message
.public static Response jsonResponse(Message protoMessage, Response.Status status)
Message
.public static Response jsonResponseBean(java.lang.Object entity, Response.Status status)
String
.
Resources which call this directly should extend PrettyJsonResource
.public static Response plainOkResponse(java.lang.String plaintext)
String
.public static Response plainResponse(java.lang.String plaintext, Response.Status status)
String
with the
provided status Response.Status
.public static Response plainResponse(java.lang.String plaintext, int statusCode)
String
with the
provided statusCode.public static Response elementNotFoundResponse()
public static Response alreadyReportedResponse()
public static Response htmlOkResponse(java.lang.String html)
public static Response htmlResponse(java.lang.String html, Response.Status status)