cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1392411 - in /cxf/trunk/rt/transports: http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
Date Mon, 01 Oct 2012 15:59:50 GMT
Author: sergeyb
Date: Mon Oct  1 15:59:50 2012
New Revision: 1392411

URL: http://svn.apache.org/viewvc?rev=1392411&view=rev
Log:
[CXF-4531] Introducing ContinuationCallback interface marked as the work in progress

Modified:
    cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java

Modified: 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/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java?rev=1392411&r1=1392410&r2=1392411&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
Mon Oct  1 15:59:50 2012
@@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.continuations.Continuation;
+import org.apache.cxf.continuations.ContinuationCallback;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.eclipse.jetty.continuation.ContinuationListener;
@@ -36,6 +37,7 @@ public class JettyContinuationWrapper im
     
     private Message message;
     private org.eclipse.jetty.continuation.Continuation continuation;
+    private ContinuationCallback callback;
     
     public JettyContinuationWrapper(HttpServletRequest request, 
                                     HttpServletResponse resp, 
@@ -48,6 +50,7 @@ public class JettyContinuationWrapper im
             request.setAttribute(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE,
                                  message.getExchange().getInMessage());
             continuation.addContinuationListener(this);
+            callback = message.getExchange().get(ContinuationCallback.class);
         }
     }
 
@@ -108,6 +111,9 @@ public class JettyContinuationWrapper im
         getMessage().remove(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE);
         isPending = false;
         //REVISIT: isResumed = false;
+        if (callback != null) {
+            callback.onComplete();
+        }
     }
 
     public void onTimeout(org.eclipse.jetty.continuation.Continuation cont) {

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java?rev=1392411&r1=1392410&r2=1392411&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
Mon Oct  1 15:59:50 2012
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.continuations.Continuation;
+import org.apache.cxf.continuations.ContinuationCallback;
 import org.apache.cxf.continuations.ContinuationProvider;
 import org.apache.cxf.message.Message;
 
@@ -66,7 +67,7 @@ public class Servlet3ContinuationProvide
         volatile boolean isResumed;
         volatile boolean isPending;
         volatile Object obj;
-        
+        private ContinuationCallback callback;
         public Servlet3Continuation() {
             // It looks current Servlet3 implementation request doesn't pass the isAsyncStart

             // status to the redispatched request, so we use the attribute to check the statues
@@ -74,6 +75,7 @@ public class Servlet3ContinuationProvide
             if (isNew) {
                 req.setAttribute(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE,
                                  inMessage.getExchange().getInMessage());
+                callback = inMessage.getExchange().get(ContinuationCallback.class);
                 context = req.startAsync(req, resp);
                 req.setAttribute(AbstractHTTPDestination.CXF_ASYNC_CONTEXT, context);
                 context.addListener(this);
@@ -133,8 +135,14 @@ public class Servlet3ContinuationProvide
                 .remove(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE);
             isPending = false;
             //REVISIT: isResumed = false;
+            if (callback != null) {
+                callback.onComplete();
+            }
         }
         public void onError(AsyncEvent event) throws IOException {
+            if (callback != null) {
+                callback.onError(event.getThrowable());
+            }
         }
         public void onStartAsync(AsyncEvent event) throws IOException {
         }



Mime
View raw message