The last one should catch it otherwise a Filter wrapping the request is
likely the easiest. If you don't care staying 100% portable a CXF
interceptor (or another extension point) does the job pretty well AFAIK


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-06-05 21:42 GMT+02:00 Kirys <[email protected]>:

> On 05/06/2016 21:20, Romain Manni-Bucau wrote:
>
>> Did you try an ExceptionMapper? It could handle 404 and delegate others.
>>
>
> tried these two without any result:
>
> @Provider
> public class EntityNotFoundMapper
>      implements ExceptionMapper<EntityNotFoundException> {
>
>    @Override
>    public Response toResponse(EntityNotFoundException e) {
>       return Response.status(Response.Status.NOT_FOUND).build();
>    }
> }
>
>
> @Provider
> public class WebApplicationExceptionHandler implements
> ExceptionMapper<WebApplicationException> {
>
>     @Override
>     public Response toResponse(WebApplicationException e) {
>         return Response.status(Response.Status.NOT_FOUND).build();
>     }
> }
>
>

Reply via email to