cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r718942 - in /cxf/branches/2.0.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 12:40:31 GMT
Author: sergeyb
Date: Wed Nov 19 04:40:29 2008
New Revision: 718942

URL: http://svn.apache.org/viewvc?rev=718942&view=rev
Log:
Merged revisions 718929 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes

................
  r718929 | sergeyb | 2008-11-19 10:53:26 +0000 (Wed, 19 Nov 2008) | 13 lines
  
  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.0.x-fixes/api/src/main/java/org/apache/cxf/continuations/
      - copied from r718929, cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/
    cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/continuations/Continuation.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/Continuation.java
    cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationInfo.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationInfo.java
    cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java
    cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationWrapper.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/ContinuationWrapper.java
    cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/continuations/SuspendedInvocationException.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/continuations/SuspendedInvocationException.java
    cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/continuations/
      - copied from r718929, cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/continuations/
    cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/continuations/ContinuationInfoTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/continuations/ContinuationInfoTest.java
    cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/continuations/SuspendedInvocationExceptionTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/continuations/SuspendedInvocationExceptionTest.java
    cxf/branches/2.0.x-fixes/rt/core/src/test/java/org/apache/cxf/transport/ChainInitiationObserverTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/core/src/test/java/org/apache/cxf/transport/ChainInitiationObserverTest.java
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/
      - copied from r718929, cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/
      - copied from r718929, cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProviderTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProviderTest.java
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/
      - copied from r718929, cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapper.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapper.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/
      - copied from r718929, cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProviderTest.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/continuations/JMSContinuationWrapperTest.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/
      - copied from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ControlWorker.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ControlWorker.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloContinuation.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloContinuation.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloContinuationService.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloContinuationService.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloWorker.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloWorker.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/cxf.xml
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/cxf.xml
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/jaxws-server.xml
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/jaxws-server.xml
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/jetty-engine.xml
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/jetty-engine.xml
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/test.wsdl
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/test.wsdl
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/
      - copied from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/GreeterImplWithContinuationsJMS.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldContinuationsClientServerTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldContinuationsClientServerTest.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/HelloWorldWithContinuationsJMS.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/JMSContinuationsClientServerTest.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/JMSContinuationsClientServerTest.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/Server.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/Server.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/Server2.java
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/Server2.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/jms_test.wsdl
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/jms_test.wsdl
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/jms_test_config.xml
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/jms_test_config.xml
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/test.wsdl
      - copied unchanged from r718929, cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/continuations/test.wsdl
Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
    cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
    cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
    cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
    cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser.java
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java   (props changed)

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 19 04:40:29 2008
@@ -1,3 +1,3 @@
-/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870,702873,702959,703193,703242,703523,704303,704587,704738,704998,705153,705280-705449,705455,709357,709641,709644,710177,710184,711736,712199,712225,712275,712600,712896,713083,713410,713413,713594,713599,713808,713901,714169-714171,718622
-/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616,702656,702957,703191,703239,703501,704584,704997,705150,705274,705340,705446,708550,708554,709353-709354,709425,710150,712194,712198,712272,712312,712670,712893,713082,713584,713597,713804,713899,714167-714168,718620
+/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870,702873,702959,703193,703242,703523,704303,704587,704738,704998,705153,705280-705449,705455,709357,709641,709644,710177,710184,711736,712199,712225,712275,712600,712896,713083,713410,713413,713594,713599,713808,713901,714169-714171,718622,718929
+/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616,702656,702957,703191,703239,703501,704584,704997,705150,705274,705340,705446,708550,708554,709353-709354,709425,710150,712194,712198,712272,712312,712670,712893,713082,713584,713597,713804,713899,714167-714168,718565,718620,718665
 /incubator/cxf/trunk:434594-651668

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

Modified: cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Wed Nov 19 04:40:29 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.0.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java (original)
+++ cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java Wed Nov 19 04:40:29 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.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java (original)
+++ cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java Wed Nov 19 04:40:29 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.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties (original)
+++ cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties Wed Nov 19 04:40:29 2008
@@ -23,4 +23,6 @@
 COULD_NOT_INSTANTIATE=Couldn't instantiate service object.
 ILLEGAL_ACCESS=Couldn't access service object.
 EXCEPTION_INVOKING_OBJECT={0} while invoking {1} with params {2}.
-INVOKING_METHOD=Invoking method {1} on object {0} with params {2}.
\ No newline at end of file
+INVOKING_METHOD=Invoking method {1} on object {0} 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.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java (original)
+++ cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java Wed Nov 19 04:40:29 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;
@@ -54,6 +55,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) {
@@ -63,18 +74,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.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java (original)
+++ cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java Wed Nov 19 04:40:29 2008
@@ -20,14 +20,22 @@
 
 
 import org.apache.cxf.common.util.factory.Factory;
+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.service.invoker.ScopePolicy;
+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);
     ScopePolicy scope = EasyMock.createMock(ScopePolicy.class);
@@ -41,9 +49,75 @@
         JAXWSMethodInvoker jaxwsMethodInvoker = new JAXWSMethodInvoker(factory);
         Exchange ex = EasyMock.createMock(Exchange.class);               
         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.0.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.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java (original)
+++ cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java Wed Nov 19 04:40:29 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.0.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.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java (original)
+++ cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java Wed Nov 19 04:40:29 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.
      */

Modified: cxf/branches/2.0.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.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser.java (original)
+++ cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser.java Wed Nov 19 04:40:29 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.0.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd (original)
+++ cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/resources/schemas/configuration/http-jetty.xsd Wed Nov 19 04:40:29 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.0.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.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java (original)
+++ cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java Wed Nov 19 04:40:29 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,
@@ -611,6 +713,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");
@@ -854,4 +957,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);
+        }
+        
+        
+    }
 }

Modified: cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=718942&r1=718941&r2=718942&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java (original)
+++ cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java Wed Nov 19 04:40:29 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 {

Propchange: cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 19 04:40:29 2008
@@ -1 +1 @@
-/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java:712600,713083,713410,713413,713594,713599,713808,713901,714169-714171,718622
+/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java:712600,713083,713410,713413,713594,713599,713808,713901,714169-714171,718622,718929



Mime
View raw message