What is the correct behavior when a JAX-RS method throws an exception that are 
not mapped by a ExceptionMapper and a ContainerResponseFilter is provided?

                @Path("/") @Produces(value = { MediaType.TEXT_PLAIN }) 
        public class ApiResources {
                public String getThrowIllegalArgumentException() {
                        throw new IllegalArgumentException( "HELLO from 
throwIllegalArgumentException" );

        public class MonitorFilter implements ContainerResponseFilter {
                 public void filter( ContainerRequestContext requestContext, 
                                 ContainerResponseContext responseContext ) 
throws IOException {
                        System.out.println(“Resource returned status=“ + 
Tested the code in wildfly-8.0.0.Alpha4 and the ContainerResponseFilter#filter 
method was not called. It was only called after a ExceptionMapper for 
IllegalArgumentException was provided.

public class IllegalStateExceptionExceptionMapper implements 
ExceptionMapper<IllegalStateException> {
        public Response toResponse( IllegalStateException e ) {
                return Response.status( Response.Status.INTERNAL_SERVER_ERROR 
).entity( e.getMessage() )

WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
Resteasy-users mailing list

Reply via email to