class UnsupportedMediaTypeExceptionMapper implements ExceptionMapper<UnsupportedMediaTypeException> {

    @Override
    public Response toResponse(UnsupportedMediaTypeException exception) {
        Response.Status status = Response.Status.UNSUPPORTED_MEDIA_TYPE;
        return Response.status(status).entity(exception.getErrorDescriptor()).build();
    }

}