Greetings. I need to intercept any kind of error happening in our application that's built on CXF. I'm designing a general purpose error handling framework for the application, and it also needs to intercept errors that may happen before our application code is executed. I.e., I'd like to treat ALL errors uniformly, whether they happen during marshalling, etc.
I've been playing around with the interceptors and filters. At first I had decided on using an interceptor. But then I read on a wiki page that it wasn't possible to change the HTTP status code if the interceptor ran after the JAXRSInOutInterceptor, so I chose to write a filter instead. I'm using Spring to configure everything. The handleResponse() method in my filter gets called, but I've found that if I return any kind of error, i.e. a category 400 or 500 type error, the XML that I'm returning as the content doesn't get rendered in the browser (I'm testing things from the browser or wget). So, what is the best strategy for creating a "catch-all" error handler for CXF? What I need to do is basically to create custom XML content for any kind of error that may happen, and return that to the client. BTW, we're mainly using JAXRS and REST calls, and do not anticipate having to handle SOAP at all. At first glance it seems like interceptors are more flexible, and that I have more control since I can choose which phase it gets invoked at. Any help is much appreciated. My environment: OS: OpenSUSE Linux 11.1 Java: Sun's JDK version 1.6.0_16-b01 CXF: 2.2.3 bundle App server: Tomcat 6.0.X Spring: 2.5.5 Thanks, /Henrik
