geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r601149 - in /geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6: ./ handler/
Date Tue, 04 Dec 2007 23:30:19 GMT
Author: djencks
Date: Tue Dec  4 15:30:18 2007
New Revision: 601149

URL: http://svn.apache.org/viewvc?rev=601149&view=rev
Log:
GERONIMO-3609 Better fix for supplying jndi on forwarded calls as well as for servlet listeners

Added:
    geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/TwistyWebAppContext.java
  (with props)
Modified:
    geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
    geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java
    geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java
    geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
    geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java
    geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/UserTransactionHandler.java

Modified: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java?rev=601149&r1=601148&r2=601149&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
(original)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
Tue Dec  4 15:30:18 2007
@@ -51,6 +51,7 @@
 import org.apache.geronimo.jetty6.handler.JettySecurityHandler;
 import org.apache.geronimo.jetty6.handler.LifecycleCommand;
 import org.apache.geronimo.jetty6.handler.ThreadClassloaderHandler;
+import org.apache.geronimo.jetty6.handler.TwistyWebAppContext;
 import org.apache.geronimo.jetty6.handler.UserTransactionHandler;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.ObjectNameUtil;
@@ -61,15 +62,14 @@
 import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
 import org.apache.geronimo.security.jacc.RunAsSource;
 import org.apache.geronimo.transaction.GeronimoUserTransaction;
+import org.mortbay.jetty.Handler;
 import org.mortbay.jetty.MimeTypes;
-import org.mortbay.jetty.handler.AbstractHandler;
 import org.mortbay.jetty.security.Authenticator;
 import org.mortbay.jetty.servlet.ErrorPageErrorHandler;
 import org.mortbay.jetty.servlet.ServletHandler;
 import org.mortbay.jetty.servlet.ServletHolder;
 import org.mortbay.jetty.servlet.ServletMapping;
 import org.mortbay.jetty.servlet.SessionHandler;
-import org.mortbay.jetty.webapp.WebAppContext;
 
 /**
  * Wrapper for a WebApplicationContext that sets up its J2EE environment.
@@ -91,7 +91,7 @@
     private String displayName;
 
     private final String objectName;
-    private final WebAppContext webAppContext;//delegate
+    private final TwistyWebAppContext webAppContext;//delegate
     private final AbstractImmutableHandler lifecycleChain;
     private final Context componentContext;
     private final Holder holder;
@@ -168,7 +168,7 @@
 
         ServletHandler servletHandler = new ServletHandler();
 
-        webAppContext = new WebAppContext(securityHandler, sessionHandler, servletHandler,
null);
+        webAppContext = new TwistyWebAppContext(securityHandler, sessionHandler, servletHandler,
null);
 
         //wrap the web app context with the jndi handler
         GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
@@ -189,13 +189,13 @@
         // localize access to next
         {
             //install the other handlers inside the web app context
-            AbstractHandler next = sessionHandler;
+            Handler next = webAppContext.newTwistyHandler();
             next = new ThreadClassloaderHandler(next, classLoader);
 
             next = new InstanceContextHandler(next, unshareableResources, applicationManagedSecurityResources,
trackedConnectionAssociator);
             next = new UserTransactionHandler(next, userTransaction);
             next = new ComponentContextHandler(next, this.componentContext);
-            webAppContext.setHandler(next);
+            webAppContext.setTwistyHandler(next);
 
             lifecycleChain = (AbstractImmutableHandler) next;
         }

Modified: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java?rev=601149&r1=601148&r2=601149&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java
(original)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java
Tue Dec  4 15:30:18 2007
@@ -27,10 +27,10 @@
 /**
  * @version $Rev$ $Date$
  */
-public abstract class AbstractImmutableHandler extends AbstractHandlerContainer {
-    protected final AbstractHandler next;
+public abstract class AbstractImmutableHandler implements Handler /*extends AbstractHandlerContainer*/
{
+    protected final Handler next;
 
-    protected AbstractImmutableHandler(AbstractHandler next) {
+    protected AbstractImmutableHandler(Handler next) {
         this.next = next;
     }
 
@@ -43,10 +43,18 @@
     }
 
     public void setServer(Server server) {
-        super.setServer(server);
+//        super.setServer(server);
         next.setServer(server);
     }
 
+    public Server getServer() {
+        return next.getServer();
+    }
+
+    public void destroy() {
+        next.destroy();
+    }
+
     public void lifecycleCommand(LifecycleCommand lifecycleCommand) throws Exception {
         if (next instanceof AbstractImmutableHandler) {
             ((AbstractImmutableHandler) next).lifecycleCommand(lifecycleCommand);
@@ -72,7 +80,39 @@
      */
     protected Object expandChildren(Object list, Class byClass)
     {
-        return expandHandler(next, list, byClass);
+//        return expandHandler(next, list, byClass);
+        return null;
     }
 
+    public void start() throws Exception {
+        next.start();
+    }
+
+    public void stop() throws Exception {
+        next.stop();
+    }
+
+    public boolean isRunning() {
+        return next.isRunning();
+    }
+
+    public boolean isStarted() {
+        return next.isStarted();
+    }
+
+    public boolean isStarting() {
+        return next.isStarting();
+    }
+
+    public boolean isStopping() {
+        return next.isStopping();
+    }
+
+    public boolean isStopped() {
+        return next.isStopped();
+    }
+
+    public boolean isFailed() {
+        return false;
+    }
 }

Modified: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java?rev=601149&r1=601148&r2=601149&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java
(original)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java
Tue Dec  4 15:30:18 2007
@@ -26,7 +26,7 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.geronimo.naming.java.RootContext;
-import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.jetty.Handler;
 
 /**
  * @version $Rev$ $Date$
@@ -35,7 +35,7 @@
 
     private final Context componentContext;
 
-    public ComponentContextHandler(AbstractHandler next, Context componentContext) {
+    public ComponentContextHandler(Handler next, Context componentContext) {
         super(next);
         this.componentContext = componentContext;
     }

Modified: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java?rev=601149&r1=601148&r2=601149&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
(original)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
Tue Dec  4 15:30:18 2007
@@ -42,7 +42,7 @@
     private final Set applicationManagedSecurityResources;
     private final TrackedConnectionAssociator trackedConnectionAssociator;
 
-    public InstanceContextHandler(AbstractHandler next, Set unshareableResources, Set applicationManagedSecurityResources,
TrackedConnectionAssociator trackedConnectionAssociator) {
+    public InstanceContextHandler(Handler next, Set unshareableResources, Set applicationManagedSecurityResources,
TrackedConnectionAssociator trackedConnectionAssociator) {
         super(next);
         this.unshareableResources = unshareableResources;
         this.applicationManagedSecurityResources = applicationManagedSecurityResources;

Modified: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java?rev=601149&r1=601148&r2=601149&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java
(original)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java
Tue Dec  4 15:30:18 2007
@@ -24,7 +24,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.jetty.Handler;
 
 /**
  * @version $Rev$ $Date$
@@ -33,7 +33,7 @@
 
     private final ClassLoader classLoader;
 
-    public ThreadClassloaderHandler(AbstractHandler next, ClassLoader classLoader) {
+    public ThreadClassloaderHandler(Handler next, ClassLoader classLoader) {
         super(next);
         this.classLoader = classLoader;
     }

Added: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/TwistyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/TwistyWebAppContext.java?rev=601149&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/TwistyWebAppContext.java
(added)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/TwistyWebAppContext.java
Tue Dec  4 15:30:18 2007
@@ -0,0 +1,112 @@
+/*
+ * 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.jetty6.handler;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.ErrorHandler;
+import org.mortbay.jetty.security.SecurityHandler;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.SessionHandler;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class TwistyWebAppContext extends WebAppContext {
+
+    private Handler handler;
+
+
+    public TwistyWebAppContext(SecurityHandler securityHandler, SessionHandler sessionHandler,
ServletHandler servletHandler, ErrorHandler errorHandler) {
+        super(securityHandler, sessionHandler, servletHandler, errorHandler);
+    }
+
+    public void setTwistyHandler(Handler handler) {
+        this.handler = handler;
+    }
+
+    public Handler newTwistyHandler() {
+        return new TwistyHandler();
+    }
+
+    @Override
+    public void handle(String target, HttpServletRequest request, HttpServletResponse response,
int dispatch) throws IOException, ServletException {
+        handler.handle(target, request, response, dispatch);
+    }
+
+    private class TwistyHandler implements Handler {
+
+        public void handle(String target, HttpServletRequest request, HttpServletResponse
response, int dispatch) throws IOException, ServletException {
+            TwistyWebAppContext.super.handle(target, request, response, dispatch);
+        }
+
+        public void setServer(Server server) {
+             TwistyWebAppContext.super.setServer(server);
+        }
+
+        public Server getServer() {
+            return TwistyWebAppContext.super.getServer();
+        }
+
+        public void destroy() {
+            TwistyWebAppContext.super.destroy();
+        }
+
+        public void start() throws Exception {
+            TwistyWebAppContext.super.start();
+        }
+
+        public void stop() throws Exception {
+            TwistyWebAppContext.super.stop();
+        }
+
+        public boolean isRunning() {
+            return TwistyWebAppContext.super.isRunning();
+        }
+
+        public boolean isStarted() {
+            return TwistyWebAppContext.super.isStarted();
+        }
+
+        public boolean isStarting() {
+            return TwistyWebAppContext.super.isStarting();
+        }
+
+        public boolean isStopping() {
+            return TwistyWebAppContext.super.isStopping();
+        }
+
+        public boolean isStopped() {
+            return TwistyWebAppContext.super.isStopped();
+        }
+
+        public boolean isFailed() {
+            return TwistyWebAppContext.super.isFailed();
+        }
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/TwistyWebAppContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/TwistyWebAppContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/TwistyWebAppContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/UserTransactionHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/UserTransactionHandler.java?rev=601149&r1=601148&r2=601149&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/UserTransactionHandler.java
(original)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/UserTransactionHandler.java
Tue Dec  4 15:30:18 2007
@@ -29,7 +29,7 @@
 import javax.transaction.SystemException;
 import javax.transaction.UserTransaction;
 
-import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.jetty.Handler;
 
 /**
  * @version $Rev$ $Date$
@@ -37,7 +37,7 @@
 public class UserTransactionHandler extends AbstractImmutableHandler {
     private final UserTransaction userTransaction;
 
-    public UserTransactionHandler(AbstractHandler next, UserTransaction userTransaction)
{
+    public UserTransactionHandler(Handler next, UserTransaction userTransaction) {
         super(next);
         this.userTransaction = userTransaction;
     }



Mime
View raw message