jaxrs exception mapper

Solutions on MaxInterview for jaxrs exception mapper by the best coders in the world

showing results for - "jaxrs exception mapper"
Lylou
09 Mar 2020
1@Provider 
2public class PersistenceMapper implements ExceptionMapper<PersistenceException> { 
3
4    @Override 
5    public Response toResponse(PersistenceException arg0) { 
6        if(arg0.getCause() instanceof InvalidDataException) {
7           return Response.status(Response.Status.BAD_REQUEST).build(); 
8        } else {
9           ...
10        }
11    } 
12
13} 
14
similar questions
queries leading to this page
jaxrs exception mapper