tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r409696 - in /tomcat/tc6.0.x/trunk/java/org/apache/catalina: connector/CoyoteAdapter.java servlets/CometServlet.java
Date Fri, 26 May 2006 16:39:09 GMT
Author: remm
Date: Fri May 26 09:39:08 2006
New Revision: 409696

URL: http://svn.apache.org/viewvc?rev=409696&view=rev
Log:
- Some small comet fixes.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CometServlet.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=409696&r1=409695&r2=409696&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Fri May 26
09:39:08 2006
@@ -116,12 +116,22 @@
         Response response = (Response) res.getNote(ADAPTER_NOTES);
 
         if (request.getWrapper() != null) {
+            
+            // Bind the context CL to the current thread
+            if (request.getContext().getLoader() != null ) {
+                Thread.currentThread().setContextClassLoader
+                        (request.getContext().getLoader().getClassLoader());
+            }
+            
             CometProcessor servlet = null;
             try {
                 servlet = (CometProcessor) request.getWrapper().allocate();
             } catch (Throwable t) {
                 log.error(sm.getString("coyoteAdapter.service"), t);
                 request.removeAttribute("org.apache.tomcat.comet");
+                // Restore the context classloader
+                Thread.currentThread().setContextClassLoader
+                    (CoyoteAdapter.class.getClassLoader());
                 return false;
             }
             try {
@@ -156,6 +166,9 @@
                     request.recycle();
                     response.recycle();
                 }
+                // Restore the context classloader
+                Thread.currentThread().setContextClassLoader
+                    (CoyoteAdapter.class.getClassLoader());
             }
         }
         return true;

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CometServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CometServlet.java?rev=409696&r1=409695&r2=409696&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CometServlet.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CometServlet.java Fri May 26 09:39:08
2006
@@ -71,12 +71,20 @@
         if (request.getAttribute("org.apache.tomcat.comet.support") == Boolean.TRUE) {
             begin(request, response);
         } else {
-            // FIXME: Implement without comet support
+            // No Comet support: regular servlet handling
             begin(request, response);
-            
-            // Loop reading data
-            
-            end(request, response);
+            boolean error = true;
+            try {
+                // Loop reading data
+                while (read(request, response));
+                error = false;
+            } finally {
+                if (error) {
+                    error(request, response);
+                } else {
+                    end(request, response);
+                }
+            }
         }
         
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message