Hi,
It would be extremely useful to be able to use EntityHolder inside an
ExceptionMapper. If a parsing error occurs converting the entity from String
to (say) JSON, I could do something like this:
@Provider
public class JsonMappingMapper implements ExceptionMapper
{
private final String entity;
/**
* Creates a new JsonMappingMapper.
*
* @param entity the entity associated with the request
*/
@Inject
public JsonMappingMapper(EntityHolder entity)
{
this.entity = entity.getEntity();
}
@Override
public Response toResponse(JsonMappingException e)
{
return Response.status(Status.BAD_REQUEST).entity(e.getMessage() +
"\nEntity:\n" + entity).
type("text/plain").build();
}
}
In other words, I would like the log the entity body as a raw String.
Should I file a feature request for this? Is there another way of
accomplishing this?
Thanks,
Gili
--
View this message in context: http://jersey.576304.n2.nabble.com/Using-EntityHolder-with-ExceptionMapper-tp6205881p6205881.html
Sent from the Jersey mailing list archive at Nabble.com.