Created
February 27, 2015 13:07
-
-
Save hascode/7ea35258f9c1bdd5707f to your computer and use it in GitHub Desktop.
Example JAX-RS Exception Mapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Provider | |
public class CustomExceptionMapper implements ExceptionMapper<CustomException> { | |
@Override | |
public Response toResponse(final CustomException exception) { | |
return Response.status(Status.BAD_REQUEST).entity(exception).type(MediaType.APPLICATION_JSON).build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment