I implemented a 400 ExceptionMapper in order to adhere to REST
best-practices, upon receiving a semantically incorrect request:
@Provider
public class SemanticExceptionMapper implements
ExceptionMapper<SemanticException> {
@Override
public Response toResponse(SemanticException ex) {
return Response.status(400)
.entity(ex.getMessage())
.type("text/plain")
.build();
}
}
It works fine except very little (well nothing) of the error message is
revealed to the user. This could be container specific I suppose (I'm
using Tomcat 6.x) or a visibility/security issue. Would anyone know
about this? The specs says "...may contain a document describing why the
server thinks there's a client-side error".
Thanks in advance,
Casper