I configure my application via a subclass of ResourceConfig:
@ApplicationPath("/sdm/vdc/v2")
public class VDCAdapterApplicationV2
extends ResourceConfig
{
public VDCAdapterApplicationV2()
{
setApplicationName("SDM VDC Adapter REST API v2");
packages(ServerResource.class.getPackage().getName());
register(JsonMarshallerProvider.class);
register(MethodNotAllowedExceptionMapper.class);
register(NotFoundExceptionMapper.class);
register(YAMLMessageBodyWriterProvider.class);
// Monitoring stuff
register(VDCApplicationEventListener.class);
// Filter and interceptors
register(PreMatchingFilter.class);
property(ServerProperties.TRACING, TracingConfig.ALL);
// Disable this annoying Moxy message body writer
// If not disabled, Jersey might pick it as MBW for my
// POJOs, Oliver B. Fischer, 4. Feb. 2014
property(CommonProperties.MOXY_JSON_FEATURE_DISABLE, Boolean.TRUE);
// Turning this on breaks CDI!!
property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE,
Boolean.FALSE);
}
}
Am 12.02.14 12:35, schrieb Pedro Nuno Santos:
> There could be several reasons... depends on your set up. Can you show your exception mapper class and jersey configuration?
>
>
> Cheers,
> Pedro
>
>
> -----Original Message-----
> From: Oliver B. Fischer [mailto:mailsink_at_swe-blog.net]
> Sent: 12 February 2014 11:19
> To: users
> Subject: [Jersey] 404, ExceptionMapper and ContainerResponseFilter
>
> I am using GlassFish 4 to run a REST API and I want to handle all not matched requests by my own.
>
> Using a ExceptionMapper for a NotFoundException does not work. The mapper is never called. Bye why is it not called by Jersey? I can handle each 404 with a custom ContainerResponseFilter.
>
> Oliver
>