cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r718929 - in /cxf/branches/2.1.x-fixes: ./ api/src/main/java/org/apache/cxf/continuations/ api/src/main/java/org/apache/cxf/phase/ api/src/test/java/org/apache/cxf/continuations/ api/src/test/java/org/apache/cxf/phase/ rt/core/src/main/java...
Date Wed, 19 Nov 2008 10:53:28 GMT
Author: sergeyb
Date: Wed Nov 19 02:53:26 2008
New Revision: 718929

URL: http://svn.apache.org/viewvc?rev=718929&view=rev
Log:
Merged revisions 718565,718665 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r718565 | sergeyb | 2008-11-18 12:27:34 +0000 (Tue, 18 Nov 2008) | 1 line
  
  CXF-1835,CXF-1912: continuations support for HTTP and JMS transports
........
  r718665 | sergeyb | 2008-11-18 17:57:07 +0000 (Tue, 18 Nov 2008) | 1 line
  
  CXF-1835,CXF-1912:renaming ContinuationWrapper interface to Continuation, updating JMSDestination to use ConcurrentLinkedQueue
........

Added:
    cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/
      - copied from r718565, cxf/trunk/api/src/main/java/org/apache/cxf/continuations/
    cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/Continuation.java
      - copied unchanged from r718665, cxf/trunk/api/src/main/java/org/apache/cxf/continuations/Continuation.java
    cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationInfo.java
      - copied unchanged from r718565, cxf/trunk/api/src/main/java/org/apache/cxf/continuations/ContinuationInfo.java
    cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java
      - copied, changed from r718565, cxf/trunk/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java
    cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/SuspendedInvocationException.java
      - copied unchanged from r718565, cxf/trunk/api/src/main/java/org/apache/cxf/continuations/SuspendedInvocationException.java
    cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/continuations/
      - copied from r718565, cxf/trunk/api/src/test/java/org/apache/cxf/continuations/
    cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/continuations/ContinuationInfoTest.java
      - copied unchanged from r718565, cxf/trunk/api/src/test/java/org/apache/cxf/continuations/ContinuationInfoTest.java
    cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/continuations/SuspendedInvocationExceptionTest.java
      - copied unchanged from r718565, cxf/trunk/api/src/test/java/org/apache/cxf/continuations/SuspendedInvocationExceptionTest.java
    cxf/branches/2.1.x-fixes/rt/core/src/test/java/org/apache/cxf/transport/ChainInitiationObserverTest.java
      - copied unchanged from r718565, cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/ChainInitiationObserverTest.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/
      - copied from r718565, cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java
      - copied, changed from r718565, cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
      - copied, changed from r718565, cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/
      - copied from r718565, cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProviderTest.java
      - copied unchanged from r718565, cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProviderTest.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java
      - copied, changed from r718565, cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/
      - copied from r718565, cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
      - copied unchanged from r718665, cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java
      - copied, changed from r718565, cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/
      - copied from r718565, cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java
      - copied, changed from r718565, cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java
      - copied, changed from r718565, cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/
      - copied from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ControlWorker.java
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ControlWorker.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloContinuation.java
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloContinuation.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloContinuationService.java
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloContinuationService.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java
      - copied, changed from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloWorker.java
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloWorker.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/cxf.xml
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/cxf.xml
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/jaxws-server.xml
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/jaxws-server.xml
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/jetty-engine.xml
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/jetty-engine.xml
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/test.wsdl
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/test.wsdl
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/
      - copied from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java
      - copied, changed from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldContinuationsClientServerTest.java
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldContinuationsClientServerTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java
      - copied, changed from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/JMSContinuationsClientServerTest.java
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/JMSContinuationsClientServerTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/Server.java
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/Server.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/Server2.java
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/Server2.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/jms_test.wsdl
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/jms_test.wsdl
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/jms_test_config.xml
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/jms_test_config.xml
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/test.wsdl
      - copied unchanged from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/test.wsdl
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
    cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
    cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
    cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 19 02:53:26 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708417,708550,708554,709353-709354,709425,710076,710150,710154,71138
 8,711410,711490,711635,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713804,713899,714167-714168,714245,717937-717961,718620
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708417,708550,708554,709353-709354,709425,710076,710150,710154,71138
 8,711410,711490,711635,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713804,713899,714167-714168,714245,717937-717961,718565,718620,718665

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

Copied: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java (from r718565, cxf/trunk/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java?p2=cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java&p1=cxf/trunk/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java (original)
+++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java Wed Nov 19 02:53:26 2008
@@ -29,5 +29,5 @@
      * Creates a new continuation or retrieves the existing one
      * @return transport-neutral ContinuationWrapper
      */
-    ContinuationWrapper getContinuation();
+    Continuation getContinuation();
 }

Modified: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Wed Nov 19 02:53:26 2008
@@ -31,6 +31,7 @@
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.InterceptorChain;
@@ -138,6 +139,11 @@
         }
     }
     
+    // this method should really be on the InterceptorChain interface
+    public State getState() {
+        return state;
+    }
+    
     public PhaseInterceptorChain cloneChain() {
         return new PhaseInterceptorChain(this);
     }
@@ -218,6 +224,13 @@
                 }
                 //System.out.println("-----------" + currentInterceptor);
                 currentInterceptor.handleMessage(message);
+            } catch (SuspendedInvocationException ex) {
+                // we need to resume from the same interceptor the exception got originated from
+                if (iterator.hasPrevious()) {
+                    iterator.previous();
+                }
+                pause();
+                throw ex;
             } catch (RuntimeException ex) {
                 if (!faultOccurred) {
  

Modified: cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java (original)
+++ cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java Wed Nov 19 02:53:26 2008
@@ -27,7 +27,9 @@
 import java.util.TreeSet;
 
 import org.apache.cxf.common.util.SortedArraySet;
+import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.message.Message;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
@@ -67,6 +69,51 @@
     }
 
     @Test
+    public void testState() throws Exception {
+        AbstractPhaseInterceptor p = setUpPhaseInterceptor("phase1", "p1");
+        control.replay();
+        chain.add(p);
+        
+        assertSame("Initial state is State.EXECUTING",
+                   InterceptorChain.State.EXECUTING, chain.getState());
+        chain.pause();
+        assertSame("Pausing chain should lead to State.PAUSED",
+                   InterceptorChain.State.PAUSED, chain.getState());
+        chain.resume();
+        assertSame("Resuming chain should lead to State.COMPLETE",
+                   InterceptorChain.State.COMPLETE, chain.getState());
+        chain.abort();
+        assertSame("Aborting chain should lead to State.ABORTED",
+                   InterceptorChain.State.ABORTED, chain.getState());
+    }
+    
+    @Test
+    public void testSuspendedException() throws Exception {
+        CountingPhaseInterceptor p1 = 
+            new CountingPhaseInterceptor("phase1", "p1");
+        SuspendedInvocationInterceptor p2 = 
+            new SuspendedInvocationInterceptor("phase2", "p2");
+        
+        message.getInterceptorChain();
+        EasyMock.expectLastCall().andReturn(chain).anyTimes();
+
+        control.replay();
+        
+        chain.add(p1);
+        chain.add(p2);
+        try {
+            chain.doIntercept(message);
+            fail("Suspended invocation swallowed");
+        } catch (SuspendedInvocationException ex) {
+            // ignore
+        }
+        
+        assertSame("No previous interceptor selected", p1, chain.iterator().next());
+        assertSame("Suspended invocation should lead to State.PAUSED",
+                   InterceptorChain.State.PAUSED, chain.getState());
+    }
+    
+    @Test
     public void testAddOneInterceptor() throws Exception {
         AbstractPhaseInterceptor p = setUpPhaseInterceptor("phase1", "p1");
         control.replay();
@@ -404,7 +451,7 @@
             invoked++;
         }
     }
-
+    
     public class WrapperingPhaseInterceptor extends CountingPhaseInterceptor {
         public WrapperingPhaseInterceptor(String phase, String id) {
             super(phase, id);
@@ -416,5 +463,15 @@
         }
     }
 
+    public class SuspendedInvocationInterceptor extends AbstractPhaseInterceptor<Message> {
+        
+        public SuspendedInvocationInterceptor(String phase, String id) {
+            super(id, phase);
+        }
+        
+        public void handleMessage(Message m) {
+            throw new SuspendedInvocationException(new Throwable());
+        }
+    }
 
 }

Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java Wed Nov 19 02:53:26 2008
@@ -29,6 +29,7 @@
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.frontend.MethodDispatcher;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
@@ -45,7 +46,6 @@
 public abstract class AbstractInvoker implements Invoker {
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractInvoker.class);
     
-    
     public Object invoke(Exchange exchange, Object o) {
 
         final Object serviceObject = getServiceObject(exchange);
@@ -87,11 +87,18 @@
             
             return new MessageContentsList(res);
         } catch (InvocationTargetException e) {
+            
             Throwable t = e.getCause();
+            
             if (t == null) {
                 t = e;
             }
+            
+            checkSuspendedInvocation(exchange, serviceObject, m, params, t);
+            
             exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
+            
+            
             for (Class<?> cl : m.getExceptionTypes()) {
                 if (cl.isInstance(t)) {
                     exchange.getInMessage().put(FaultMode.class, 
@@ -105,16 +112,38 @@
                 throw (Fault)t;
             }
             throw createFault(t, m, params, true);
+        } catch (SuspendedInvocationException suspendedEx) {
+            // to avoid duplicating the same log statement
+            checkSuspendedInvocation(exchange, serviceObject, m, params, suspendedEx);
+            // unreachable
+            throw suspendedEx;
         } catch (Fault f) {
             exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
             throw f;
         } catch (Exception e) {
+            checkSuspendedInvocation(exchange, serviceObject, m, params, e);
             exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
             throw createFault(e, m, params, false);
         }
     }
     
+    protected void checkSuspendedInvocation(Exchange exchange,
+                                            Object serviceObject, 
+                                            Method m, 
+                                            List<Object> params, 
+                                            Throwable t) {
+        if (t instanceof SuspendedInvocationException) {
+            
+            if (LOG.isLoggable(Level.FINE)) {
+                LOG.log(Level.FINE, "SUSPENDED_INVOCATION_EXCEPTION", 
+                        new Object[]{serviceObject, m.toString(), params});
+            }
+            throw (SuspendedInvocationException)t;
+        }
+    }
+    
     protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean checked) {
+        
         if (checked) {
             return new Fault(ex);
         } else {

Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties Wed Nov 19 02:53:26 2008
@@ -24,4 +24,5 @@
 ILLEGAL_ACCESS=Couldn't access service object.
 CREATE_SERVICE_OBJECT_EXC=Couldn't instantiate service object.
 EXCEPTION_INVOKING_OBJECT={0} while invoking {1} with params {2}.
+SUSPENDED_INVOCATION_EXCEPTION=Invocation of method {1} on object {0} with params {2} has been suspended.
 INVOKING_METHOD=Invoking method {1} on object {0} with params {2}.

Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java Wed Nov 19 02:53:26 2008
@@ -29,6 +29,7 @@
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
@@ -55,6 +56,16 @@
         Bus origBus = BusFactory.getThreadDefaultBus(false);
         BusFactory.setThreadDefaultBus(bus);
         try {
+            PhaseInterceptorChain phaseChain = null;
+            
+            if (m.getInterceptorChain() instanceof PhaseInterceptorChain) {
+                phaseChain = (PhaseInterceptorChain)m.getInterceptorChain();
+                if (phaseChain.getState() == InterceptorChain.State.PAUSED) {
+                    phaseChain.resume();
+                    return;
+                }
+            }
+            
             Message message = getBinding().createMessage(m);
             Exchange exchange = message.getExchange();
             if (exchange == null) {
@@ -64,18 +75,18 @@
             setExchangeProperties(exchange, message);
     
             // setup chain
-            PhaseInterceptorChain chain = chainCache.get(bus.getExtension(PhaseManager.class).getInPhases(),
+            phaseChain = chainCache.get(bus.getExtension(PhaseManager.class).getInPhases(),
                                                          bus.getInInterceptors(),
                                                          endpoint.getService().getInInterceptors(),
                                                          endpoint.getInInterceptors(),
                                                          getBinding().getInInterceptors());
             
             
-            message.setInterceptorChain(chain);
+            message.setInterceptorChain(phaseChain);
             
-            chain.setFaultObserver(endpoint.getOutFaultObserver());
+            phaseChain.setFaultObserver(endpoint.getOutFaultObserver());
            
-            chain.doIntercept(message);
+            phaseChain.doIntercept(message);
         } finally {
             BusFactory.setThreadDefaultBus(origBus);
         }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java Wed Nov 19 02:53:26 2008
@@ -19,14 +19,21 @@
 package org.apache.cxf.jaxws;
 
 
+import org.apache.cxf.continuations.SuspendedInvocationException;
+import org.apache.cxf.frontend.MethodDispatcher;
 import org.apache.cxf.jaxws.service.Hello;
 import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.Service;
 import org.apache.cxf.service.invoker.Factory;
+import org.apache.cxf.service.model.BindingOperationInfo;
 import org.easymock.classextension.EasyMock;
 import org.junit.Assert;
 import org.junit.Test;
 
-public class JAXWSMethodInvokerTest {
+public class JAXWSMethodInvokerTest extends Assert {
     Factory factory = EasyMock.createMock(Factory.class);
     Object target = EasyMock.createMock(Hello.class);
         
@@ -39,9 +46,75 @@
         EasyMock.replay(factory);
         JAXWSMethodInvoker jaxwsMethodInvoker = new JAXWSMethodInvoker(factory);
         Object object = jaxwsMethodInvoker.getServiceObject(ex);
-        Assert.assertEquals("the target object and service object should be equal ", object, target);
+        assertEquals("the target object and service object should be equal ", object, target);
         EasyMock.verify(factory);
     }
         
 
+    @Test
+    public void testSuspendedException() throws Throwable {
+        Exchange ex = EasyMock.createNiceMock(Exchange.class);               
+        
+        Exception originalException = new RuntimeException();
+        ContinuationService serviceObject = 
+            new ContinuationService(originalException);
+        EasyMock.reset(factory);
+        factory.create(ex);
+        EasyMock.expectLastCall().andReturn(serviceObject);
+        factory.release(ex, serviceObject);
+        EasyMock.expectLastCall();
+        EasyMock.replay(factory);
+                        
+        Message inMessage = new MessageImpl();
+        ex.getInMessage();
+        EasyMock.expectLastCall().andReturn(inMessage);
+        inMessage.setExchange(ex);
+        inMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
+                
+        BindingOperationInfo boi = EasyMock.createMock(BindingOperationInfo.class);
+        ex.get(BindingOperationInfo.class);
+        EasyMock.expectLastCall().andReturn(boi);
+        
+        Service serviceClass = EasyMock.createMock(Service.class);
+        ex.get(Service.class);
+        EasyMock.expectLastCall().andReturn(serviceClass);
+        
+        MethodDispatcher md = EasyMock.createMock(MethodDispatcher.class);
+        serviceClass.get(MethodDispatcher.class.getName());
+        EasyMock.expectLastCall().andReturn(md);
+        
+        md.getMethod(boi);
+        EasyMock.expectLastCall().andReturn(
+            ContinuationService.class.getMethod("invoke", new Class[]{}));
+        
+        EasyMock.replay(ex);
+        EasyMock.replay(md);
+        EasyMock.replay(serviceClass);
+        
+        JAXWSMethodInvoker jaxwsMethodInvoker = new JAXWSMethodInvoker(factory);
+        try {
+            jaxwsMethodInvoker.invoke(ex, new MessageContentsList(new Object[]{}));
+            fail("Suspended invocation swallowed");
+        } catch (SuspendedInvocationException suspendedEx) {
+            assertSame(suspendedEx, serviceObject.getSuspendedException());
+            assertSame(originalException, suspendedEx.getRuntimeException());
+        }
+        
+    }
+    
+    public static class ContinuationService {
+        private RuntimeException ex;
+        
+        public ContinuationService(Exception throwable) {
+            ex = new SuspendedInvocationException(throwable);
+        }
+        
+        public void invoke() {
+            throw ex;
+        }
+        
+        public Throwable getSuspendedException() {
+            return ex;
+        }
+    }
 }

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java Wed Nov 19 02:53:26 2008
@@ -33,24 +33,29 @@
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.continuations.ContinuationInfo;
+import org.apache.cxf.continuations.ContinuationProvider;
+import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.transport.http.HTTPSession;
+import org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider;
 import org.apache.cxf.transports.http.QueryHandler;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.apache.cxf.transports.http.StemMatchingQueryHandler;
 import org.mortbay.jetty.HttpConnection;
 import org.mortbay.jetty.Request;
+import org.mortbay.util.ajax.Continuation;
+import org.mortbay.util.ajax.ContinuationSupport;
 
 public class JettyHTTPDestination extends AbstractHTTPDestination {
     
     private static final Logger LOG =
         LogUtils.getL7dLogger(JettyHTTPDestination.class);
 
-    
     protected JettyHTTPServerEngine engine;
     protected JettyHTTPTransportFactory transportFactory;
     protected JettyHTTPServerEngineFactory serverEngineFactory;
@@ -78,6 +83,7 @@
             JettyHTTPTransportFactory ci, 
             EndpointInfo              endpointInfo
     ) throws IOException {
+        
         //Add the defualt port if the address is missing it
         super(b, ci, endpointInfo, true);
         this.transportFactory = ci;
@@ -261,24 +267,39 @@
         throws IOException {
         Request baseRequest = (req instanceof Request) 
             ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
-        try {
-            if (LOG.isLoggable(Level.FINE)) {
-                LOG.fine("Service http request on thread: " + Thread.currentThread());
+        
+        if (LOG.isLoggable(Level.FINE)) {
+            LOG.fine("Service http request on thread: " + Thread.currentThread());
+        }
+        MessageImpl inMessage = retrieveFromContinuation(req);
+        
+        
+        if (inMessage == null) {
+            
+            inMessage = new MessageImpl();
+            if (engine.getContinuationsEnabled()) {
+                inMessage.put(ContinuationProvider.class.getName(), 
+                          new JettyContinuationProvider(req, inMessage));
             }
-
-            MessageImpl inMessage = new MessageImpl();
+            
             setupMessage(inMessage, context, req, resp);
             
             inMessage.setDestination(this);
-
+    
             ExchangeImpl exchange = new ExchangeImpl();
             exchange.setInMessage(inMessage);
             exchange.setSession(new HTTPSession(req));
-            
-            incomingObserver.onMessage(inMessage);
+        }
 
+        try {    
+            incomingObserver.onMessage(inMessage);
+            
             resp.flushBuffer();
             baseRequest.setHandled(true);
+        } catch (SuspendedInvocationException ex) {
+            throw ex.getRuntimeException();
+        } catch (RuntimeException ex) {
+            throw ex;
         } finally {
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.fine("Finished servicing http request on thread: " + Thread.currentThread());
@@ -286,6 +307,39 @@
         }
     }
 
+    protected MessageImpl retrieveFromContinuation(HttpServletRequest req) {
+        MessageImpl m = null;
+        
+        if (!engine.getContinuationsEnabled()) {
+            return null;
+        }
+        
+        Continuation cont = ContinuationSupport.getContinuation(req, null);
+        synchronized (cont) {
+            Object o = cont.getObject();
+            if (o instanceof ContinuationInfo) {
+                ContinuationInfo ci = (ContinuationInfo)o;
+                m = (MessageImpl)ci.getMessage();
+                
+                // now that we got the message we don't need ContinuationInfo
+                // as we don't know how continuation was suspended, by jetty wrapper
+                // or directly in which (latter) case we need to ensure that an original user object
+                // if any, need to be restored
+                cont.setObject(ci.getUserObject());
+            }
+            if (m == null && !cont.isNew()) {
+                String message = "No message for existing continuation, status : "
+                    + (cont.isPending() ? "Pending" : "Resumed");
+                if (!(o instanceof ContinuationInfo)) {
+                    message += ", ContinuationInfo object is unavailable";
+                }
+                LOG.warning(message);
+            }
+        }
+        
+        return m;
+    }
+    
     @Override
     public void shutdown() {
         transportFactory.removeDestination(endpointInfo);

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java Wed Nov 19 02:53:26 2008
@@ -92,6 +92,7 @@
     
     private Boolean isSessionSupport = false;
     private Boolean isReuseAddress = true;
+    private Boolean continuationsEnabled = true;
     private int servantCount;
     private Server server;
     private Connector connector;
@@ -99,6 +100,7 @@
     private JettyConnectorFactory connectorFactory;
     private ContextHandlerCollection contexts;
     
+    
     /**
      * This field holds the TLS ServerParameters that are programatically
      * configured. The tlsServerParamers (due to JAXB) holds the struct
@@ -116,7 +118,7 @@
      * has been called.
      */
     private boolean configFinalized;
-    
+        
     /**
      * This constructor is called by the JettyHTTPServerEngineFactory.
      */
@@ -140,6 +142,15 @@
     public void setPort(int p) {
         port = p;
     }
+    
+    public void setContinuationsEnabled(boolean enabled) {
+        continuationsEnabled = enabled;
+    }
+    
+    public boolean getContinuationsEnabled() {
+        return continuationsEnabled;
+    }
+    
     /**
      * The bus.
      */

Copied: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java (from r718565, cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java?p2=cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java&p1=cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java Wed Nov 19 02:53:26 2008
@@ -21,11 +21,9 @@
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.continuations.ContinuationProvider;
-import org.apache.cxf.continuations.ContinuationWrapper;
 import org.apache.cxf.message.Message;
-import org.mortbay.util.ajax.Continuation;
-import org.mortbay.util.ajax.ContinuationSupport;
 
 public class JettyContinuationProvider implements ContinuationProvider {
 
@@ -37,12 +35,11 @@
         this.inMessage = m;
     }
     
-    public ContinuationWrapper getContinuation() {
+    public Continuation getContinuation() {
         if (inMessage.getExchange().isOneWay()) {
             return null;
         }
-        Continuation cont = ContinuationSupport.getContinuation(request, null);
-        return new JettyContinuationWrapper(cont, inMessage);
+        return new JettyContinuationWrapper(request, inMessage);
     }
 
 }

Copied: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java (from r718565, cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java?p2=cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java&p1=cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java Wed Nov 19 02:53:26 2008
@@ -19,21 +19,23 @@
 
 package org.apache.cxf.transport.http_jetty.continuations;
 
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.continuations.ContinuationInfo;
-import org.apache.cxf.continuations.ContinuationWrapper;
 import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.message.Message;
 import org.mortbay.jetty.RetryRequest;
-import org.mortbay.util.ajax.Continuation;
+import org.mortbay.util.ajax.ContinuationSupport;
 
-public class JettyContinuationWrapper implements ContinuationWrapper {
+public class JettyContinuationWrapper implements Continuation {
 
-    private Continuation continuation;
+    private org.mortbay.util.ajax.Continuation continuation;
     private Message message;
     
     
-    public JettyContinuationWrapper(Continuation c, Message m) {
-        continuation = c; 
+    public JettyContinuationWrapper(HttpServletRequest request, Message m) {
+        continuation = ContinuationSupport.getContinuation(request, null); 
         message = m;
     }
 
@@ -95,7 +97,7 @@
         return message;
     }
     
-    protected Continuation getContinuation() {
+    protected org.mortbay.util.ajax.Continuation getContinuation() {
         return continuation;
     }
     

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser.java Wed Nov 19 02:53:26 2008
@@ -57,6 +57,11 @@
         int port = Integer.valueOf(portStr);
         bean.addPropertyValue("port", port);
                
+        String continuationsStr = element.getAttribute("continuationsEnabled");
+        if (continuationsStr != null && continuationsStr.length() > 0) {
+            bean.addPropertyValue("continuationsEnabled", Boolean.parseBoolean(continuationsStr));
+        }
+        
         MutablePropertyValues engineFactoryProperties = ctx.getContainingBeanDefinition().getPropertyValues();
         PropertyValue busValue = engineFactoryProperties.getPropertyValue("bus");
               

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd Wed Nov 19 02:53:26 2008
@@ -121,14 +121,21 @@
          <xs:element name="sessionSupport" type="xsd:boolean" minOccurs="0"/>
          <xs:element name="reuseAddress" type="xsd:boolean" minOccurs="0" />          
        </xs:sequence>
-          <xs:attribute name="port" type="xs:int" use="required">
+       
+       <xs:attribute name="port" type="xs:int" use="required">
              <xs:annotation>
                 <xs:documentation>Specifies the port used by the Jetty instance.
                 You can specify a value of 0 for the port attribute. Any threading 
                 properties specified in an engine element with its port attribute
                 set to 0 are used as the configuration for all Jetty listeners that are not explicitly configured.</xs:documentation>
              </xs:annotation>
-          </xs:attribute>
+       </xs:attribute>
+       <xs:attribute name="continuationsEnabled" type="xs:boolean">
+           <xs:annotation>
+                <xs:documentation>Specifies if Jetty Continuations will be explicitly supported
+                by Jetty destinations. Continuations will be checked if this attribute is set to true or                            omitted, ignored otherwise</xs:documentation>
+             </xs:annotation>
+       </xs:attribute>
     </xs:complexType>
     
     <xs:complexType name="JettyHTTPServerEngineFactoryConfigType">

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java Wed Nov 19 02:53:26 2008
@@ -29,6 +29,7 @@
 
 import javax.servlet.ServletInputStream;
 import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
 import javax.xml.bind.JAXBElement;
 import javax.xml.namespace.QName;
 
@@ -38,6 +39,8 @@
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.continuations.ContinuationInfo;
+import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.endpoint.EndpointResolverRegistry;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.io.AbstractWrappedOutputStream;
@@ -56,6 +59,7 @@
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.easymock.classextension.EasyMock;
@@ -65,8 +69,7 @@
 import org.mortbay.jetty.HttpFields;
 import org.mortbay.jetty.Request;
 import org.mortbay.jetty.Response;
-
-import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND;
+import org.mortbay.util.ajax.Continuation;
 
 public class JettyHTTPDestinationTest extends Assert {
     protected static final String AUTH_HEADER = "Authorization";
@@ -175,6 +178,103 @@
     }
     
     @Test
+    public void testSuspendedException() throws Exception {
+        destination = setUpDestination(false, false);
+        setUpDoService(false);
+        final RuntimeException ex = new RuntimeException();
+        observer = new MessageObserver() {
+            public void onMessage(Message m) {
+                throw new SuspendedInvocationException(ex);
+            }
+        };
+        destination.setMessageObserver(observer);
+        try {
+            destination.doService(request, response);
+            fail("Suspended invocation swallowed");
+        } catch (RuntimeException runtimeEx) {
+            assertSame("Original exception is not preserved", ex, runtimeEx);
+        }
+    }
+    
+    @Test
+    public void testRetrieveFromContinuation() throws Exception {
+        
+        Continuation continuation = EasyMock.createMock(Continuation.class);
+        
+        Message m = new MessageImpl();
+        ContinuationInfo ci = new ContinuationInfo(m);
+        Object userObject = new Object();
+        ci.setUserObject(userObject);
+        continuation.getObject();
+        EasyMock.expectLastCall().andReturn(ci);
+        continuation.setObject(ci.getUserObject());
+        EasyMock.expectLastCall();
+        EasyMock.replay(continuation);
+        
+        HttpServletRequest httpRequest = EasyMock.createMock(HttpServletRequest.class);
+        httpRequest.getAttribute("org.mortbay.jetty.ajax.Continuation");
+        EasyMock.expectLastCall().andReturn(continuation);
+        EasyMock.replay(httpRequest);
+        
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));
+        EndpointInfo ei = new EndpointInfo(serviceInfo, "");
+        ei.setName(new QName("bla", "Port"));
+        
+        transportFactory = new JettyHTTPTransportFactory();
+        transportFactory.setBus(new CXFBusImpl());
+        
+        TestJettyDestination testDestination = 
+            new TestJettyDestination(transportFactory.getBus(), 
+                                     transportFactory, ei);
+        testDestination.finalizeConfig();
+        MessageImpl mi = testDestination.retrieveFromContinuation(httpRequest);
+        assertSame("Message is lost", m, mi);
+        EasyMock.verify(continuation);
+        EasyMock.reset(httpRequest);
+        httpRequest.getAttribute("org.mortbay.jetty.ajax.Continuation");
+        EasyMock.expectLastCall().andReturn(null);
+        mi = testDestination.retrieveFromContinuation(httpRequest);
+        assertNotSame("New message expected", m, mi);
+    }
+    
+    @Test
+    public void testContinuationsIgnored() throws Exception {
+        
+        Continuation continuation = EasyMock.createMock(Continuation.class);
+        HttpServletRequest httpRequest = EasyMock.createMock(HttpServletRequest.class);
+        httpRequest.getAttribute("org.mortbay.jetty.ajax.Continuation");
+        EasyMock.expectLastCall().andReturn(continuation);
+        EasyMock.replay(httpRequest);
+        
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));
+        EndpointInfo ei = new EndpointInfo(serviceInfo, "");
+        ei.setName(new QName("bla", "Port"));
+        
+        final JettyHTTPServerEngine httpEngine = new JettyHTTPServerEngine();
+        httpEngine.setContinuationsEnabled(false);
+        JettyHTTPServerEngineFactory factory = new JettyHTTPServerEngineFactory() {
+            @Override
+            public JettyHTTPServerEngine retrieveJettyHTTPServerEngine(int port) {
+                return httpEngine;
+            }
+        };
+        transportFactory = new JettyHTTPTransportFactory();
+        transportFactory.setBus(new CXFBusImpl());
+        transportFactory.getBus().setExtension(
+            factory, JettyHTTPServerEngineFactory.class);
+        
+        
+        TestJettyDestination testDestination = 
+            new TestJettyDestination(transportFactory.getBus(), 
+                                     transportFactory, ei);
+        testDestination.finalizeConfig();
+        MessageImpl mi = testDestination.retrieveFromContinuation(httpRequest);
+        assertNull("Continuations must be ignored", mi);
+    }
+    
+    @Test
     public void testGetMultiple() throws Exception {
         transportFactory = new JettyHTTPTransportFactory();
         transportFactory.setBus(new CXFBusImpl());
@@ -449,7 +549,7 @@
         maps.getToEndpointReference();
         EasyMock.expectLastCall().andReturn(refWithId);
         EasyMock.replay(maps);      
-        context.put(SERVER_ADDRESSING_PROPERTIES_INBOUND, maps);
+        context.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, maps);
         String result = destination.getId(context);
         assertNotNull(result);
         assertEquals("match our id", result, id);
@@ -495,7 +595,7 @@
             EasyMock.replay(bus);
         }
         
-        engine = EasyMock.createMock(JettyHTTPServerEngine.class);
+        engine = EasyMock.createNiceMock(JettyHTTPServerEngine.class);
         ServiceInfo serviceInfo = new ServiceInfo();
         serviceInfo.setName(new QName("bla", "Service"));        
         endpointInfo = new EndpointInfo(serviceInfo, "");
@@ -506,6 +606,8 @@
         engine.addServant(EasyMock.eq(new URL(NOWHERE + "bar/foo")),
                           EasyMock.isA(JettyHTTPHandler.class));
         EasyMock.expectLastCall();
+        engine.getContinuationsEnabled();
+        EasyMock.expectLastCall().andReturn(true);
         EasyMock.replay(engine);
         
         JettyHTTPDestination dest = new EasyMockJettyHTTPDestination(bus,
@@ -612,6 +714,7 @@
                 EasyMock.expect(request.getQueryString()).andReturn(query);    
                 EasyMock.expect(request.getHeader("Accept")).andReturn("*/*");  
                 EasyMock.expect(request.getContentType()).andReturn("text/xml charset=utf8");
+                EasyMock.expect(request.getAttribute("org.mortbay.jetty.ajax.Continuation")).andReturn(null);
                 
                 HttpFields httpFields = new HttpFields();
                 httpFields.add("content-type", "text/xml");
@@ -855,4 +958,19 @@
     static EndpointReferenceType getEPR(String s) {
         return EndpointReferenceUtils.getEndpointReference(NOWHERE + s);
     }
+    
+    private static class TestJettyDestination extends JettyHTTPDestination {
+        public TestJettyDestination(Bus b,
+                                    JettyHTTPTransportFactory ci, 
+                                    EndpointInfo endpointInfo) throws IOException {
+            super(b, ci, endpointInfo);
+        }
+        
+        @Override
+        public MessageImpl retrieveFromContinuation(HttpServletRequest request) {
+            return super.retrieveFromContinuation(request);
+        }
+        
+        
+    }
 }

Copied: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java (from r718565, cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java?p2=cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java&p1=cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java Wed Nov 19 02:53:26 2008
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.transport.http_jetty.continuations;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.cxf.continuations.ContinuationInfo;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
@@ -35,6 +37,7 @@
         ContinuationInfo ci = new ContinuationInfo(m);
         Object userObject = new Object();
         
+               
         Continuation c = EasyMock.createMock(Continuation.class);
         c.isNew();
         EasyMock.expectLastCall().andReturn(true);
@@ -55,7 +58,12 @@
         EasyMock.expectLastCall().andReturn(true);
         EasyMock.replay(c);
         
-        JettyContinuationWrapper cw = new JettyContinuationWrapper(c, m);
+        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
+        request.getAttribute("org.mortbay.jetty.ajax.Continuation");
+        EasyMock.expectLastCall().andReturn(c);
+        EasyMock.replay(request);
+        
+        JettyContinuationWrapper cw = new JettyContinuationWrapper(request, m);
         cw.isNew();
         cw.isPending();
         cw.isResumed();

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=718929&r1=718928&r2=718929&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java Wed Nov 19 02:53:26 2008
@@ -25,11 +25,13 @@
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Calendar;
+import java.util.Collection;
 import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.Map;
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
+import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -44,6 +46,8 @@
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.ConfigurationException;
+import org.apache.cxf.continuations.ContinuationProvider;
+import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -53,6 +57,8 @@
 import org.apache.cxf.transport.AbstractMultiplexDestination;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.jms.continuations.JMSContinuation;
+import org.apache.cxf.transport.jms.continuations.JMSContinuationProvider;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.springframework.jms.core.JmsTemplate;
@@ -70,6 +76,8 @@
     private JMSConfiguration jmsConfig;
     private Bus bus;
     private DefaultMessageListenerContainer jmsListener;
+    private Collection<JMSContinuation> continuations = 
+        new ConcurrentLinkedQueue<JMSContinuation>();
 
     public JMSDestination(Bus b, EndpointInfo info, JMSConfiguration jmsConfig) {
         super(b, getTargetReference(info, b), info);
@@ -170,10 +178,18 @@
             inMessage.put(JMSConstants.JMS_REQUEST_MESSAGE, message);
             inMessage.setDestination(this);
 
+            inMessage.put(ContinuationProvider.class.getName(), 
+                          new JMSContinuationProvider(bus,
+                                                      inMessage,
+                                                      incomingObserver,
+                                                      continuations));
+            
             BusFactory.setThreadDefaultBus(bus);
 
             // handle the incoming message
             incomingObserver.onMessage(inMessage);
+        } catch (SuspendedInvocationException ex) {
+            System.out.println("Request message has been suspended");
         } catch (UnsupportedEncodingException ex) {
             getLogger().log(Level.WARNING, "can't get the right encoding information. " + ex);
         } finally {

Copied: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java (from r718565, cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java?p2=cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java&p1=cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java Wed Nov 19 02:53:26 2008
@@ -19,11 +19,11 @@
 
 package org.apache.cxf.transport.jms.continuations;
 
-import java.util.List;
+import java.util.Collection;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.continuations.ContinuationProvider;
-import org.apache.cxf.continuations.ContinuationWrapper;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.transport.MessageObserver;
 
@@ -32,29 +32,29 @@
     private Bus bus;
     private Message inMessage;
     private MessageObserver incomingObserver;
-    private List<JMSContinuationWrapper> continuations;
+    private Collection<JMSContinuation> continuations;
     
     public JMSContinuationProvider(Bus b,
                                    Message m, 
                                    MessageObserver observer,
-                                   List<JMSContinuationWrapper> cList) {
+                                   Collection<JMSContinuation> cList) {
         bus = b;
         inMessage = m;    
         incomingObserver = observer;
         continuations = cList;
     }
     
-    public ContinuationWrapper getContinuation() {
+    public Continuation getContinuation() {
         if (inMessage.getExchange().isOneWay()) {
             return null;
         }
-        JMSContinuationWrapper cw = inMessage.get(JMSContinuationWrapper.class);
+        JMSContinuation cw = inMessage.get(JMSContinuation.class);
         if (cw == null) {
-            cw = new JMSContinuationWrapper(bus,
+            cw = new JMSContinuation(bus,
                                            inMessage, 
                                            incomingObserver,
                                            continuations);
-            inMessage.put(JMSContinuationWrapper.class, cw);
+            inMessage.put(JMSContinuation.class, cw);
         }
         return cw;
         

Copied: cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java (from r718565, cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java?p2=cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java&p1=cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java Wed Nov 19 02:53:26 2008
@@ -19,7 +19,7 @@
 
 package org.apache.cxf.transport.jms.continuations;
 
-import org.apache.cxf.continuations.ContinuationWrapper;
+import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
@@ -45,19 +45,19 @@
         Message m = new MessageImpl();
         m.setExchange(new ExchangeImpl());
         JMSContinuationProvider provider = new JMSContinuationProvider(null, m, null, null);
-        ContinuationWrapper cw = provider.getContinuation(); 
+        Continuation cw = provider.getContinuation(); 
         assertTrue(cw.isNew());
-        assertSame(cw, m.get(JMSContinuationWrapper.class));
+        assertSame(cw, m.get(JMSContinuation.class));
     }
     
     @Test
     public void testGetExistingContinuation() {
         Message m = new MessageImpl();
         m.setExchange(new ExchangeImpl());
-        JMSContinuationWrapper cw = new JMSContinuationWrapper(null, m, null, null);
-        m.put(JMSContinuationWrapper.class, cw);
+        JMSContinuation cw = new JMSContinuation(null, m, null, null);
+        m.put(JMSContinuation.class, cw);
         JMSContinuationProvider provider = new JMSContinuationProvider(null, m, null, null);
         assertSame(cw, provider.getContinuation());
-        assertSame(cw, m.get(JMSContinuationWrapper.class));
+        assertSame(cw, m.get(JMSContinuation.class));
     }
 }

Copied: cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java (from r718565, cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java?p2=cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java&p1=cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java Wed Nov 19 02:53:26 2008
@@ -37,22 +37,22 @@
 public class JMSContinuationWrapperTest extends Assert {
 
     private Message m;
-    private List<JMSContinuationWrapper> continuations;
+    private List<JMSContinuation> continuations;
     private Bus b;
     private MessageObserver observer;
     
     @Before
     public void setUp() {
         m = new MessageImpl();
-        continuations = new LinkedList<JMSContinuationWrapper>();
+        continuations = new LinkedList<JMSContinuation>();
         b = BusFactory.getDefaultBus();
         observer = EasyMock.createMock(MessageObserver.class);
     }
     
     @Test
     public void testInitialStatus() {
-        JMSContinuationWrapper cw = 
-            new JMSContinuationWrapper(b, m, observer, continuations);
+        JMSContinuation cw = 
+            new JMSContinuation(b, m, observer, continuations);
         assertTrue(cw.isNew());
         assertFalse(cw.isPending());
         assertFalse(cw.isResumed());
@@ -97,15 +97,15 @@
     
     @Test
     public void testUserObject() {
-        JMSContinuationWrapper cw = 
-            new JMSContinuationWrapper(b, m, observer, continuations);
+        JMSContinuation cw = 
+            new JMSContinuation(b, m, observer, continuations);
         assertNull(cw.getObject());
         Object userObject = new Object();
         cw.setObject(userObject);
         assertSame(userObject, cw.getObject());
     }
     
-    private static class TestJMSContinuationWrapper extends JMSContinuationWrapper {
+    private static class TestJMSContinuationWrapper extends JMSContinuation {
         
         private boolean taskCreated;
         private boolean taskCancelled;
@@ -113,7 +113,7 @@
         public TestJMSContinuationWrapper(Bus b,
                                           Message m, 
                                           MessageObserver observer,
-                                          List<JMSContinuationWrapper> cList) {
+                                          List<JMSContinuation> cList) {
             super(b, m, observer, cList);
         }
         

Copied: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java (from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java?p2=cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java&p1=cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java Wed Nov 19 02:53:26 2008
@@ -24,8 +24,8 @@
 import javax.jws.WebService;
 import javax.xml.ws.WebServiceContext;
 
+import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.continuations.ContinuationProvider;
-import org.apache.cxf.continuations.ContinuationWrapper;
 
 
 @WebService(name = "HelloContinuation", 
@@ -36,8 +36,8 @@
 public class HelloImplWithWrapppedContinuation implements HelloContinuation {
     
     
-    private Map<String, ContinuationWrapper> suspended = 
-        new HashMap<String, ContinuationWrapper>();
+    private Map<String, Continuation> suspended = 
+        new HashMap<String, Continuation>();
     
     
     @Resource
@@ -45,7 +45,7 @@
     
     public String sayHi(String firstName, String secondName) {
         
-        ContinuationWrapper continuation = getContinuation(firstName);
+        Continuation continuation = getContinuation(firstName);
         if (continuation == null) {
             throw new RuntimeException("Failed to get continuation");
         }
@@ -87,7 +87,7 @@
 
     public void resumeRequest(final String name) {
         
-        ContinuationWrapper suspendedCont = null;
+        Continuation suspendedCont = null;
         synchronized (suspended) {
             suspendedCont = suspended.get(name);
         }
@@ -99,7 +99,7 @@
         }
     }
     
-    private void suspendInvocation(String name, ContinuationWrapper cont) {
+    private void suspendInvocation(String name, Continuation cont) {
         try {
             cont.suspend(20000);    
         } finally {
@@ -110,9 +110,9 @@
         }
     }
     
-    private ContinuationWrapper getContinuation(String name) {
+    private Continuation getContinuation(String name) {
         synchronized (suspended) {
-            ContinuationWrapper suspendedCont = suspended.remove(name);
+            Continuation suspendedCont = suspended.remove(name);
             if (suspendedCont != null) {
                 return suspendedCont;
             }

Copied: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java (from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java?p2=cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java&p1=cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java Wed Nov 19 02:53:26 2008
@@ -22,8 +22,8 @@
 import javax.jws.WebService;
 import javax.xml.ws.WebServiceContext;
 
+import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.continuations.ContinuationProvider;
-import org.apache.cxf.continuations.ContinuationWrapper;
 
 
 
@@ -52,7 +52,7 @@
     
     public String greetMe(String name) {
         
-        ContinuationWrapper continuation = getContinuation(name);
+        Continuation continuation = getContinuation(name);
         if (continuation == null) {
             throw new RuntimeException("Failed to get continuation");
         }
@@ -84,7 +84,7 @@
         return null;        
     }
     
-    private ContinuationWrapper getContinuation(String name) {
+    private Continuation getContinuation(String name) {
         
         ContinuationProvider provider = 
             (ContinuationProvider)context.getMessageContext().get(ContinuationProvider.class.getName());

Copied: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java (from r718565, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java?p2=cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java&p1=cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java&r1=718565&r2=718929&rev=718929&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java Wed Nov 19 02:53:26 2008
@@ -29,8 +29,8 @@
 import javax.jws.WebService;
 import javax.xml.ws.WebServiceContext;
 
+import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.continuations.ContinuationProvider;
-import org.apache.cxf.continuations.ContinuationWrapper;
 import org.apache.cxf.systest.http_jetty.continuations.HelloContinuation;
 
 
@@ -43,8 +43,8 @@
             wsdlLocation = "org/apache/cxf/systest/jms/continuations/test.wsdl")
 public class HelloWorldWithContinuationsJMS implements HelloContinuation {    
     
-    private Map<String, ContinuationWrapper> suspended = 
-        new HashMap<String, ContinuationWrapper>();
+    private Map<String, Continuation> suspended = 
+        new HashMap<String, Continuation>();
     private Executor executor = new ThreadPoolExecutor(5, 5, 0, TimeUnit.SECONDS,
                                         new ArrayBlockingQueue<Runnable>(10));
     
@@ -53,7 +53,7 @@
     
     public String sayHi(String firstName, String secondName) {
         
-        ContinuationWrapper continuation = getContinuation(firstName);
+        Continuation continuation = getContinuation(firstName);
         if (continuation == null) {
             throw new RuntimeException("Failed to get continuation");
         }
@@ -97,7 +97,7 @@
 
     public void resumeRequest(final String name) {
         
-        ContinuationWrapper suspendedCont = null;
+        Continuation suspendedCont = null;
         synchronized (suspended) {
             suspendedCont = suspended.get(name);
         }
@@ -109,7 +109,7 @@
         }
     }
     
-    private void suspendInvocation(final String name, ContinuationWrapper cont) {
+    private void suspendInvocation(final String name, Continuation cont) {
         
         System.out.println("Suspending invocation for " + name);
         
@@ -132,12 +132,12 @@
         }
     }
     
-    private ContinuationWrapper getContinuation(String name) {
+    private Continuation getContinuation(String name) {
         
         System.out.println("Getting continuation for " + name);
         
         synchronized (suspended) {
-            ContinuationWrapper suspendedCont = suspended.remove(name);
+            Continuation suspendedCont = suspended.remove(name);
             if (suspendedCont != null) {
                 return suspendedCont;
             }



Mime
View raw message