List of usage examples for com.fasterxml.jackson.jaxrs.smile SmileMediaTypes APPLICATION_JACKSON_SMILE_TYPE
MediaType APPLICATION_JACKSON_SMILE_TYPE
To view the source code for com.fasterxml.jackson.jaxrs.smile SmileMediaTypes APPLICATION_JACKSON_SMILE_TYPE.
Click Source Link
From source file:com.qwazr.server.ServerException.java
public static WebApplicationException from(final WebApplicationException webAppException) { final Response response = webAppException.getResponse(); if (response == null) return webAppException; final MediaType type = response.getMediaType(); if (type == null || !response.hasEntity()) return webAppException; final String message; if (type.isCompatible(MediaType.TEXT_PLAIN_TYPE) || type.isCompatible(MediaType.TEXT_HTML_TYPE)) { message = response.readEntity(String.class); } else if (type.isCompatible(MediaType.APPLICATION_JSON_TYPE) || type.isCompatible(SmileMediaTypes.APPLICATION_JACKSON_SMILE_TYPE)) { try {/*from w w w . jav a2s . c o m*/ message = response.readEntity(JsonExceptionResponse.class).message; } catch (ProcessingException e) { return webAppException; } } else return webAppException; return StringUtils.isBlank(message) ? webAppException : new WebApplicationException(message, response.getStatus()); }