cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1528051 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
Date Tue, 01 Oct 2013 11:47:39 GMT
Author: sergeyb
Date: Tue Oct  1 11:47:39 2013
New Revision: 1528051

URL: http://svn.apache.org/r1528051
Log:
[CXF-5300] CXF InInterceptor fault mapping is done by default on the trunk, optional in CXF
2.7.x

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=1528051&r1=1528050&r2=1528051&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
Tue Oct  1 11:47:39 2013
@@ -252,30 +252,34 @@ public class JAXRSInInterceptor extends 
     public void handleFault(Message message) {
         super.handleFault(message);
         
-        Response r = JAXRSUtils.convertFaultToResponse(message.getContent(Exception.class),

-                                                       message);
-        if (r != null) {
-            message.removeContent(Exception.class);
-            message.getInterceptorChain().setFaultObserver(null);
-            if (message.getContextualProperty(FaultListener.class.getName()) == null) {
-                message.put(FaultListener.class.getName(), new NoOpFaultListener());
-            }
-            
-            Endpoint e = message.getExchange().get(Endpoint.class);
-            Message mout = new MessageImpl();
-            mout.setContent(List.class, new MessageContentsList(r));
-            mout.setExchange(message.getExchange());
-            mout = e.getBinding().createMessage(mout);
-            mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
-            message.getExchange().setOutMessage(mout);
-            
-            
-            Iterator<Interceptor<? extends Message>> iterator = message.getInterceptorChain().iterator();
-            while (iterator.hasNext()) {
-                Interceptor<? extends Message> inInterceptor = iterator.next();
-                if (inInterceptor.getClass() == OutgoingChainInterceptor.class) {
-                    ((OutgoingChainInterceptor)inInterceptor).handleMessage(message);
-                    return;
+        Object mapProp = message.getContextualProperty("map.cxf.interceptor.fault");
+        if (mapProp == null || MessageUtils.isTrue(mapProp)) {
+        
+            Response r = JAXRSUtils.convertFaultToResponse(message.getContent(Exception.class),

+                                                           message);
+            if (r != null) {
+                message.removeContent(Exception.class);
+                message.getInterceptorChain().setFaultObserver(null);
+                if (message.getContextualProperty(FaultListener.class.getName()) == null)
{
+                    message.put(FaultListener.class.getName(), new NoOpFaultListener());
+                }
+                
+                Endpoint e = message.getExchange().get(Endpoint.class);
+                Message mout = new MessageImpl();
+                mout.setContent(List.class, new MessageContentsList(r));
+                mout.setExchange(message.getExchange());
+                mout = e.getBinding().createMessage(mout);
+                mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
+                message.getExchange().setOutMessage(mout);
+                
+                
+                Iterator<Interceptor<? extends Message>> iterator = message.getInterceptorChain().iterator();
+                while (iterator.hasNext()) {
+                    Interceptor<? extends Message> inInterceptor = iterator.next();
+                    if (inInterceptor.getClass() == OutgoingChainInterceptor.class) {
+                        ((OutgoingChainInterceptor)inInterceptor).handleMessage(message);
+                        return;
+                    }
                 }
             }
         }



Mime
View raw message