public class RestUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static Set<String> |
supportedMediaTypes |
| Constructor and Description |
|---|
RestUtil() |
| Modifier and Type | Method and Description |
|---|---|
static javax.ws.rs.core.Response |
createResponse(javax.servlet.ServletContext servletContext,
javax.ws.rs.core.Response.Status status,
Object entity,
javax.ws.rs.core.HttpHeaders headers)
Create a
Response with the given parameters. |
static javax.ws.rs.core.MediaType |
getAcceptedMediaType(javax.ws.rs.core.HttpHeaders headers,
javax.ws.rs.core.MediaType defaultMediaType) |
static boolean |
isHTMLaccepted(javax.ws.rs.core.HttpHeaders headers) |
static boolean |
isJSONaccepted(javax.ws.rs.core.HttpHeaders headers) |
static String |
nullify(String parameter) |
public static String nullify(String parameter)
parameter - parameter to be checkednull if parameter has an empty content, otherwise trimmed parameterpublic static boolean isJSONaccepted(javax.ws.rs.core.HttpHeaders headers)
public static boolean isHTMLaccepted(javax.ws.rs.core.HttpHeaders headers)
public static javax.ws.rs.core.MediaType getAcceptedMediaType(javax.ws.rs.core.HttpHeaders headers,
javax.ws.rs.core.MediaType defaultMediaType)
public static javax.ws.rs.core.Response createResponse(javax.servlet.ServletContext servletContext,
javax.ws.rs.core.Response.Status status,
Object entity,
javax.ws.rs.core.HttpHeaders headers)
Response with the given parameters. It also add the necessary headers for CORS by
calling the CorsHelper#addCORSOrigin(ServletContext, ResponseBuilder, HttpHeaders) method.servletContext - status - entity - headers - Copyright © 2011-2014 The Apache Software Foundation. All Rights Reserved.