[jax-rs-spec users] [jsr339-experts] ExceptionMappers and WebApplicationExceptions

From: Sergey Beryozkin <>
Date: Thu, 25 Oct 2012 21:57:48 +0100


I would like to clarify the details of the way WebApplicationExceptions
are mapped on the server.

Here is what I recall we talked about the other day.

The code throws "new WebApplicationException(404)", and both
WebApplicationException and NotFoundException mappers are available.

Given NotFoundException is effectively WebApplicationException(404),
NotFoundException mapper is chosen.

Similarly, if the code throws "new ServerErrorException(500)" and both
ServerErrorException and InternalServerErrorException mappers are
available, InternalServerErrorException gets chosen.

Is it the way it should work ? This obviously is an exception to the
default mapping algorithm, but it appears it is logical given that the
runtime understands the relationship between various API exception classes

Cheers. Sergey