public class WebResourceUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Map<java.lang.String,com.google.common.net.MediaType> |
IMAGE_FORMAT_MIME_TYPES |
Constructor and Description |
---|
WebResourceUtils() |
Modifier and Type | Method and Description |
---|---|
static javax.ws.rs.WebApplicationException |
badRequest(java.lang.String format,
java.lang.Object... args) |
static javax.ws.rs.core.MediaType |
getImageMediaTypeFromExtension(java.lang.String extension) |
static java.lang.Object |
getValueForDisplay(java.lang.Object value,
boolean preferJson,
boolean isJerseyReturnValue)
as
getValueForDisplay(ObjectMapper, Object, boolean, boolean) with no mapper
(so will only handle a subset of types) |
static java.lang.Object |
getValueForDisplay(org.codehaus.jackson.map.ObjectMapper mapper,
java.lang.Object value,
boolean preferJson,
boolean isJerseyReturnValue)
returns an object which jersey will handle nicely, converting to json,
sometimes wrapping in quotes if needed (for outermost json return types);
if json is not preferred, this simply applies a toString-style rendering
|
static javax.ws.rs.WebApplicationException |
notFound(java.lang.String format,
java.lang.Object... args) |
static javax.ws.rs.WebApplicationException |
preconditionFailed(java.lang.String format,
java.lang.Object... args) |
static javax.ws.rs.WebApplicationException |
serverError(java.lang.String format,
java.lang.Object... args) |
static javax.ws.rs.WebApplicationException |
throwWebApplicationException(javax.ws.rs.core.Response.Status status,
java.lang.String format,
java.lang.Object... args) |
static javax.ws.rs.WebApplicationException |
unauthorized(java.lang.String format,
java.lang.Object... args) |
public static final java.util.Map<java.lang.String,com.google.common.net.MediaType> IMAGE_FORMAT_MIME_TYPES
public static javax.ws.rs.WebApplicationException throwWebApplicationException(javax.ws.rs.core.Response.Status status, java.lang.String format, java.lang.Object... args)
javax.ws.rs.WebApplicationException
- with an ApiError as its body and the given status as its response code.public static javax.ws.rs.WebApplicationException serverError(java.lang.String format, java.lang.Object... args)
javax.ws.rs.WebApplicationException
- With code 500 internal server errorpublic static javax.ws.rs.WebApplicationException badRequest(java.lang.String format, java.lang.Object... args)
javax.ws.rs.WebApplicationException
- With code 400 bad requestpublic static javax.ws.rs.WebApplicationException unauthorized(java.lang.String format, java.lang.Object... args)
javax.ws.rs.WebApplicationException
- With code 401 unauthorizedpublic static javax.ws.rs.WebApplicationException notFound(java.lang.String format, java.lang.Object... args)
javax.ws.rs.WebApplicationException
- With code 404 not foundpublic static javax.ws.rs.WebApplicationException preconditionFailed(java.lang.String format, java.lang.Object... args)
javax.ws.rs.WebApplicationException
- With code 412 precondition failedpublic static javax.ws.rs.core.MediaType getImageMediaTypeFromExtension(java.lang.String extension)
public static java.lang.Object getValueForDisplay(java.lang.Object value, boolean preferJson, boolean isJerseyReturnValue)
getValueForDisplay(ObjectMapper, Object, boolean, boolean)
with no mapper
(so will only handle a subset of types)public static java.lang.Object getValueForDisplay(org.codehaus.jackson.map.ObjectMapper mapper, java.lang.Object value, boolean preferJson, boolean isJerseyReturnValue)