cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1528055 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java
Date Tue, 01 Oct 2013 11:53:17 GMT
Author: sergeyb
Date: Tue Oct  1 11:53:16 2013
New Revision: 1528055

URL: http://svn.apache.org/r1528055
Log:
Merged revisions 1528051 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1528051 | sergeyb | 2013-10-01 12:47:39 +0100 (Tue, 01 Oct 2013) | 1 line
  
  [CXF-5300] CXF InInterceptor fault mapping is done by default on the trunk, optional in
CXF 2.7.x
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
    cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1528051

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=1528055&r1=1528054&r2=1528055&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
Tue Oct  1 11:53:16 2013
@@ -289,30 +289,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 (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;
+                    }
                 }
             }
         }

Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java?rev=1528055&r1=1528054&r2=1528055&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java
Tue Oct  1 11:53:16 2013
@@ -35,6 +35,7 @@ public class CustomInFaultyInterceptor e
         
         String requestUri = (String)message.get(Message.REQUEST_URI);
         if (requestUri.endsWith("/infault")) {
+            message.put("map.cxf.interceptor.fault", true);
             throw new WebApplicationException(401);
         }
         



Mime
View raw message