cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1080469 - /cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Date Fri, 11 Mar 2011 07:02:59 GMT
Author: ffang
Date: Fri Mar 11 07:02:58 2011
New Revision: 1080469

URL: http://svn.apache.org/viewvc?rev=1080469&view=rev
Log:
[CXF-3369]set SecurityHandler which wrap JettyHttpHandler to the ContextHandler

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

Modified: cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=1080469&r1=1080468&r2=1080469&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Fri Mar 11 07:02:58 2011
@@ -297,6 +297,7 @@ public class JettyHTTPServerEngine
      * @param handler notified on incoming HTTP requests
      */
     public synchronized void addServant(URL url, JettyHTTPHandler handler) {
+        SecurityHandler securityHandler = null;
         if (server == null) {
             DefaultHandler defaultHandler = null;
             // create a new jetty server instance if there is no server there           

@@ -351,7 +352,6 @@ public class JettyHTTPServerEngine
              * one to start, or it is now one containing only the single handler
              * that was there to begin with.
              */
-
             if (handlers != null && handlers.size() > 0) {
                 for (Handler h : handlers) {
                     // Filtering out the jetty default handler 
@@ -366,8 +366,10 @@ public class JettyHTTPServerEngine
                             //set JettyHTTPHandler as inner handler if 
                             //inner handler is null
                             ((SecurityHandler)h).setHandler(handler);
-                        } 
-                        handlerCollection.addHandler(h);
+                            securityHandler = (SecurityHandler)h;
+                        } else {
+                            handlerCollection.addHandler(h);
+                        }
                     }
                 }
             }
@@ -415,11 +417,21 @@ public class JettyHTTPServerEngine
                 sessionManager.setIdManager(idManager);
             }
             SessionHandler sessionHandler = new SessionHandler(sessionManager);
-            sessionHandler.setHandler(handler);
+            if (securityHandler != null) {
+                //use the securityHander which already wrap the jetty http handler
+                sessionHandler.setHandler(securityHandler);
+            } else {
+                sessionHandler.setHandler(handler);
+            }
             context.setHandler(sessionHandler);
         } else {
             // otherwise, just the one.
-            context.setHandler(handler);
+            if (securityHandler != null) {
+                //use the securityHander which already wrap the jetty http handler
+                context.setHandler(securityHandler);
+            } else {
+                context.setHandler(handler);
+            }
         }
         contexts.addHandler(context);
         



Mime
View raw message