geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r799120 - in /geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat: EngineGBean.java valve/ThreadCleanerValve.java
Date Wed, 29 Jul 2009 23:23:26 GMT
Author: xuhaihong
Date: Wed Jul 29 23:23:25 2009
New Revision: 799120

URL: http://svn.apache.org/viewvc?rev=799120&view=rev
Log:
GERONIMO-4748 Security context is not cleared before the thread is returned to the pool for
Tomcat 

Added:
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/valve/ThreadCleanerValve.java
  (with props)
Modified:
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java

Modified: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java?rev=799120&r1=799119&r2=799120&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java
(original)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/EngineGBean.java
Wed Jul 29 23:23:25 2009
@@ -39,6 +39,7 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.system.jmx.MBeanServerReference;
 import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
+import org.apache.geronimo.tomcat.valve.ThreadCleanerValve;
 import org.apache.tomcat.util.modeler.Registry;
 
 /**
@@ -109,10 +110,12 @@
 
         //Add the valve and listener lists
         if (engine instanceof StandardEngine){
+            StandardEngine standardEngine = (StandardEngine)engine;
+            standardEngine.addValve(new ThreadCleanerValve());
             if (tomcatValveChain != null){
                 ValveGBean valveGBean = tomcatValveChain;
                 while(valveGBean != null){
-                    ((StandardEngine)engine).addValve((Valve)valveGBean.getInternalObject());
+                    standardEngine.addValve((Valve)valveGBean.getInternalObject());
                     valveGBean = valveGBean.getNextValve();
                 }
             }

Added: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/valve/ThreadCleanerValve.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/valve/ThreadCleanerValve.java?rev=799120&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/valve/ThreadCleanerValve.java
(added)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/valve/ThreadCleanerValve.java
Wed Jul 29 23:23:25 2009
@@ -0,0 +1,45 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.tomcat.valve;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.valves.ValveBase;
+import org.apache.geronimo.security.Callers;
+import org.apache.geronimo.security.ContextManager;
+
+/**
+ *  A hacker valve used to clean up the security association before returning the thread
to the pool.
+ *  Please refer to GERONIMO-4748 for details
+ *  @version $Rev$ $Date$ 
+ */
+public class ThreadCleanerValve extends ValveBase {
+
+    public void invoke(Request request, Response response) throws IOException, ServletException
{
+        Callers oldCallers = ContextManager.getCallers();
+        try {
+            getNext().invoke(request, response);
+        } finally {
+            ContextManager.popCallers(oldCallers);
+        }
+    }
+}

Propchange: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/valve/ThreadCleanerValve.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/valve/ThreadCleanerValve.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/valve/ThreadCleanerValve.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message