cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r551112 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/phase/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/ rt/frontend/jaxws/src/main/java/org/apach...
Date Wed, 27 Jun 2007 10:01:08 GMT
Author: jliu
Date: Wed Jun 27 03:01:07 2007
New Revision: 551112

URL: http://svn.apache.org/viewvc?view=rev&rev=551112
Log:
Refactor Dispatch inbound/outbound chain to use same logical/soap handler interceptor, easier
to read.

Added:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
      - copied, changed from r551017, incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerOutInterceptor.java
Removed:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerOutInterceptor.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java?view=diff&rev=551112&r1=551111&r2=551112
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
Wed Jun 27 03:01:07 2007
@@ -73,10 +73,10 @@
         return phase;
     }
 
-    /**
-     * @deprecated Pass the phase into the constructor.  This method will 
-     * be removed shortly
-     * @param p
+    /*
+     * REVISIT: Not sure why this was deprecated, need to reset Phase especially
+     * when same interceptor is added into inbound and outbound chain, thus need
+     * different Phases.
      */
     public void setPhase(String p) {
         this.phase = p;

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?view=diff&rev=551112&r1=551111&r2=551112
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
Wed Jun 27 03:01:07 2007
@@ -59,10 +59,8 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.MessageSenderInterceptor;
-import org.apache.cxf.jaxws.handler.logical.DispatchLogicalHandlerOutInterceptor;
-import org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor;
+import org.apache.cxf.jaxws.handler.logical.DispatchLogicalHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.soap.DispatchSOAPHandlerInterceptor;
-import org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor;
 import org.apache.cxf.jaxws.interceptors.DispatchInInterceptor;
 import org.apache.cxf.jaxws.interceptors.DispatchOutInterceptor;
 import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
@@ -70,6 +68,7 @@
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.phase.PhaseManager;
 import org.apache.cxf.transport.MessageObserver;
@@ -242,7 +241,7 @@
             } else {
                 // TODO: what for non soap bindings?
             }       
-            chain.add(new DispatchLogicalHandlerOutInterceptor(jaxwsBinding));
+            chain.add(new DispatchLogicalHandlerInterceptor(jaxwsBinding));
         }   
         
         chain.add(new MessageSenderInterceptor());
@@ -270,9 +269,11 @@
         if (endpoint instanceof JaxWsEndpointImpl) {
             Binding jaxwsBinding = ((JaxWsEndpointImpl)endpoint).getJaxwsBinding();
             if (endpoint.getBinding() instanceof SoapBinding) {
-                chain.add(new SOAPHandlerInterceptor(jaxwsBinding));
+                chain.add(new DispatchSOAPHandlerInterceptor(jaxwsBinding));
             }      
-            chain.add(new LogicalHandlerInInterceptor(jaxwsBinding));
+            DispatchLogicalHandlerInterceptor slhi = new DispatchLogicalHandlerInterceptor(jaxwsBinding);
+            slhi.setPhase(Phase.USER_LOGICAL);            
+            chain.add(slhi);
         }           
 
         List<Interceptor> inInterceptors = new ArrayList<Interceptor>();

Copied: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
(from r551017, incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerOutInterceptor.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java?view=diff&rev=551112&p1=incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerOutInterceptor.java&r1=551017&p2=incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java&r2=551112
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
Wed Jun 27 03:01:07 2007
@@ -32,10 +32,10 @@
 import org.apache.cxf.transport.MessageObserver;
 
 
-public class DispatchLogicalHandlerOutInterceptor<T extends Message> 
+public class DispatchLogicalHandlerInterceptor<T extends Message> 
     extends AbstractJAXWSHandlerInterceptor<T> {
      
-    public DispatchLogicalHandlerOutInterceptor(Binding binding) {
+    public DispatchLogicalHandlerInterceptor(Binding binding) {
         super(binding, Phase.PRE_MARSHAL);
     }
     
@@ -52,22 +52,31 @@
         ContextPropertiesMapping.mapCxf2Jaxws(message.getExchange(), lctx, requestor);  
       
         
         if (!invoker.invokeLogicalHandlers(requestor, lctx) && requestor) {
-            // client side - abort
-            message.getInterceptorChain().abort();
-            Endpoint e = message.getExchange().get(Endpoint.class);
-            Message responseMsg = e.getBinding().createMessage();
+            if (isOutbound(message)) {
+                // client side outbound - the request message becomes the
+                // response message
+                message.getInterceptorChain().abort();
+                Endpoint e = message.getExchange().get(Endpoint.class);
+                Message responseMsg = e.getBinding().createMessage();
 
-            MessageObserver observer = (MessageObserver)message.getExchange().get(MessageObserver.class);
-            if (observer != null) {
-                //client side outbound, the request message becomes the response message
-                responseMsg.setContent(XMLStreamReader.class, message.getContent(XMLStreamReader.class));
+                MessageObserver observer = (MessageObserver)message.getExchange().get(MessageObserver.class);
+                if (observer != null) {
+                    responseMsg.setContent(XMLStreamReader.class, message.getContent(XMLStreamReader.class));
 
-                message.getExchange().setInMessage(responseMsg);
-                responseMsg.put(PhaseInterceptorChain.STARTING_AT_INTERCEPTOR_ID,
-                                LogicalHandlerInInterceptor.class.getName());
-                observer.onMessage(responseMsg);
+                    message.getExchange().setInMessage(responseMsg);
+                    responseMsg.put(PhaseInterceptorChain.STARTING_AT_INTERCEPTOR_ID,
+                                    LogicalHandlerInInterceptor.class.getName());
+                    observer.onMessage(responseMsg);
+                }
+            } else {
+                //Client side inbound, thus no response expected, do nothing, the close will
 
+                //be handled by MEPComplete later
             }
-
+        }
+        
+        //If this is the inbound and end of MEP, call MEP completion
+        if (!isOutbound(message) && isMEPComlete(message)) {
+            onCompletion(message);
         }
     }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java?view=diff&rev=551112&r1=551111&r2=551112
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java
Wed Jun 27 03:01:07 2007
@@ -119,7 +119,6 @@
                 // stops, but the inbound interceptor chain still continues, dispatch the
message
                 //By onCompletion here, we can skip following Logical handlers 
                 onCompletion(message);
-                //System.out.println("SOAP Handler handleMessage returns false on client
inbound, aborting");
             }
         }
     }



Mime
View raw message