I am trying to setup a custom exception handler which would catch exception 
from service methods and translate them in Response.error and custom xml.

Try 1
Use <jaxrs: outFaultInterceptors>
Spring complained

Try2
<jaxrs:server id="infraRedAuthenticationServiceJaxrs" address="/user">
                                <jaxrs:providers>
                                                <ref bean="authInterceptor"/>
                                                <ref 
bean="exceptionInterceptor"/>
                                </jaxrs:providers>
                                <jaxrs:serviceBeans>
                                                <ref bean="userService"/>
                                </jaxrs:serviceBeans>
                </jaxrs:server>

Where exceptionInterceptor is
public class ExceptionInterceptor extends AbstractPhaseInterceptor<Message> {

      public ExceptionInterceptor() {
            this(Phase.MARSHAL);
      }

      public ExceptionInterceptor(String phase) {
            super(phase);
      }

      @Override
      public void handleMessage(Message message) throws Fault {
            message.toString();

      }

      @Override
      public void handleFault(Message message) {
            super.handleFault(message);
      }

}

but my break points are not hit when throwing exception from service method
      @GET
      @Path("/generalexception")
      public Response throwUserException() throws Exception {
            throw new Exception("Foo");
      }

Vitaly

Reply via email to