You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2006/09/21 21:35:19 UTC
svn commit: r448643 - in
/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6:
./ handler/ interceptor/
Author: djencks
Date: Thu Sep 21 12:35:18 2006
New Revision: 448643
URL: http://svn.apache.org/viewvc?view=rev&rev=448643
Log:
Convert remaining before-afters to handlers. Not clear if servlet init is called with appropriate contexts
Added:
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java (with props)
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java (with props)
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java (with props)
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/JettySecurityHandler.java (contents, props changed)
- copied, changed from r448418, geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettySecurityHandler.java
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java (with props)
Removed:
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettySecurityHandler.java
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/BeforeAfter.java
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ComponentContextBeforeAfter.java
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/InstanceContextBeforeAfter.java
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ThreadClassloaderBeforeAfter.java
Modified:
geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java?view=diff&rev=448643&r1=448642&r2=448643
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java Thu Sep 21 12:35:18 2006
@@ -42,10 +42,10 @@
import org.apache.geronimo.gbean.GBeanLifecycle;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
-import org.apache.geronimo.jetty6.interceptor.BeforeAfter;
-import org.apache.geronimo.jetty6.interceptor.ComponentContextBeforeAfter;
-import org.apache.geronimo.jetty6.interceptor.InstanceContextBeforeAfter;
-import org.apache.geronimo.jetty6.interceptor.ThreadClassloaderBeforeAfter;
+import org.apache.geronimo.jetty6.handler.ComponentContextHandler;
+import org.apache.geronimo.jetty6.handler.InstanceContextHandler;
+import org.apache.geronimo.jetty6.handler.JettySecurityHandler;
+import org.apache.geronimo.jetty6.handler.ThreadClassloaderHandler;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.ObjectNameUtil;
import org.apache.geronimo.management.J2EEApplication;
@@ -56,14 +56,13 @@
import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
import org.apache.geronimo.security.deploy.DefaultPrincipal;
import org.apache.geronimo.transaction.GeronimoUserTransaction;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.Response;
+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.servlet.ErrorPageErrorHandler;
import org.mortbay.jetty.webapp.WebAppContext;
/**
@@ -87,9 +86,6 @@
private String displayName;
private final String[] welcomeFiles;
- private final BeforeAfter chain;
- private final int contextLength;
-
private final String objectName;
private final WebAppContext webAppContext;//delegate
@@ -106,8 +102,6 @@
jettyContainer = null;
webAppRoot = null;
// handleInterceptor = null;
- chain = null;
- contextLength = 0;
welcomeFiles = null;
objectName = null;
configurationBaseURL = null;
@@ -155,7 +149,7 @@
assert transactionManager != null;
assert trackedConnectionAssociator != null;
assert jettyContainer != null;
- SessionHandler sessionHandler = handlerFactory == null? null: handlerFactory.createHandler();
+ SessionHandler sessionHandler = handlerFactory == null ? new SessionHandler() : handlerFactory.createHandler();
//TODO construct an interceptor chain inside one of the Handlers.
JettySecurityHandler securityHandler = null;
if (securityRealmName != null) {
@@ -168,6 +162,14 @@
securityHandler.init(policyContextID, defaultPrincipal, checkedPermissions, excludedPermissions, classLoader);
}
this.webAppContext = new WebAppContext(securityHandler, sessionHandler, null, null);
+ AbstractHandler next = sessionHandler;
+ next = new ThreadClassloaderHandler(next, classLoader);
+
+ GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
+ Context enc = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext, userTransaction, kernel, classLoader);
+ next = new ComponentContextHandler(next, enc);
+ next = new InstanceContextHandler(next, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator);
+ webAppContext.setHandler(next);
this.server = server;
this.application = application;
@@ -205,19 +207,10 @@
this.webAppContext.getSecurityHandler().setAuthenticator(authenticator);
setTagLibMap(tagLibMap);
- if (false == distributable) {
+ if (!distributable) {
setSessionTimeoutSeconds(sessionTimeoutSeconds);
}
- GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
- Context enc = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext, userTransaction, kernel, webClassLoader);
-
- int index = 0;
- BeforeAfter interceptor = new InstanceContextBeforeAfter(null, index++, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator);
- interceptor = new ComponentContextBeforeAfter(interceptor, index++, enc);
- interceptor = new ThreadClassloaderBeforeAfter(interceptor, index++, index++, this.webClassLoader);
- chain = interceptor;
- contextLength = index;
}
@@ -286,39 +279,6 @@
return this.webAppContext.getContextPath();
}
- public Object enterContextScope(Request httpRequest, Response httpResponse) {
- Object[] context = new Object[contextLength];
- chain.before(context, httpRequest, httpResponse);
- return context;
- }
-
- public void leaveContextScope(Request httpRequest, Response httpResponse, Object oldScope) {
- Object[] context = (Object[]) oldScope;
- chain.after(context, httpRequest, httpResponse);
- }
-
-// public void handle(HttpRequest httpRequest, HttpResponse httpResponse) throws HttpException, IOException {
-// super.handle(httpRequest, httpResponse);
-// }
-
-// public void handle(String pathInContext, String pathParams, HttpRequest httpRequest, HttpResponse httpResponse)
-// throws HttpException, IOException {
-// ServletHttpRequest request = (ServletHttpRequest) httpRequest.getWrapper();
-// if (null == request) {
-// request = new GeronimoServletHttpRequest(handler, null, httpRequest);
-// ((GeronimoServletHttpRequest) request).setRequestedSessionId(pathParams);
-// ServletHttpResponse response = new ServletHttpResponse(request, httpResponse);
-// httpRequest.setWrapper(request);
-// httpResponse.setWrapper(response);
-// }
-//
-// if (null != handleInterceptor) {
-// handleInterceptor.handle(pathInContext, pathParams, httpRequest, httpResponse, new EndHandleInterceptor());
-// } else {
-// super.handle(pathInContext, pathParams, httpRequest, httpResponse);
-// }
-// }
-
public ClassLoader getWebClassLoader() {
return webClassLoader;
}
@@ -326,30 +286,14 @@
public void doStart() throws Exception {
// reset the classsloader... jetty likes to set it to null when stopping
this.webAppContext.setClassLoader(webClassLoader);
- this.webAppContext.setWar(webAppRoot.toString());
+ this.webAppContext.setWar(webAppRoot);
jettyContainer.addContext(this.webAppContext);
- Object context = enterContextScope(null, null);
- try {
- this.webAppContext.start();
- } finally {
- leaveContextScope(null, null, context);
- }
- //super.doStart sets welcomefiles to null!!
- //TODO probably not for jetty6
- //this.webAppContext.setWelcomeFiles(welcomeFiles);
-
- log.debug("JettyWebAppContext started");
+ this.webAppContext.start();
}
public void doStop() throws Exception {
- Object context = enterContextScope(null, null);
- try {
- this.webAppContext.stop();
- } finally {
- leaveContextScope(null, null, context);
- jettyContainer.removeContext(this.webAppContext);
- }
+ this.webAppContext.stop();
// No more logging will occur for this ClassLoader. Inform the LogFactory to avoid a memory leak.
LogFactory.release(webClassLoader);
@@ -361,6 +305,7 @@
try {
doStop();
} catch (Exception e) {
+ //ignore
}
log.warn("JettyWebAppContext failed");
@@ -390,7 +335,7 @@
public void setErrorPages(Map errorPageMap) {
if (errorPageMap != null) {
- ((ErrorPageErrorHandler)this.webAppContext.getErrorHandler()).setErrorPages(errorPageMap);
+ ((ErrorPageErrorHandler) this.webAppContext.getErrorHandler()).setErrorPages(errorPageMap);
}
}
@@ -486,12 +431,8 @@
this.webAppContext.getServletHandler().addServletMapping(servletMapping);
}
}
- Object context = enterContextScope(null, null);
- try {
- servletHolder.start();
- } finally {
- leaveContextScope(null, null, context);
- }
+ //most likely this is not done with correct jndi, classloader, or connection tracking
+ servletHolder.start();
if (objectName != null) {
synchronized (servletNames) {
servletNames.add(objectName);
Added: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java?view=auto&rev=448643
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java (added)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java Thu Sep 21 12:35:18 2006
@@ -0,0 +1,51 @@
+/*
+ * 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 org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Server;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public abstract class AbstractImmutableHandler extends AbstractHandler {
+ protected final AbstractHandler next;
+
+ protected AbstractImmutableHandler(AbstractHandler next) {
+ this.next = next;
+ }
+
+ protected void doStart() throws Exception {
+ next.start();
+ }
+
+ protected void doStop() throws Exception {
+ next.stop();
+ }
+
+ public void setServer(Server server) {
+ super.setServer(server);
+ next.setServer(server);
+ }
+
+
+}
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/AbstractImmutableHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java?view=auto&rev=448643
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java (added)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java Thu Sep 21 12:35:18 2006
@@ -0,0 +1,54 @@
+/*
+ * 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.naming.Context;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.geronimo.naming.java.RootContext;
+import org.mortbay.jetty.handler.AbstractHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentContextHandler extends AbstractImmutableHandler {
+
+ private final Context componentContext;
+
+ public ComponentContextHandler(AbstractHandler next, Context componentContext) {
+ super(next);
+ this.componentContext = componentContext;
+ }
+
+ public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException {
+ Context oldContext = RootContext.getComponentContext();
+ try {
+ RootContext.setComponentContext(componentContext);
+ next.handle(target, request, response, dispatch);
+ } finally {
+ RootContext.setComponentContext(oldContext);
+ }
+ }
+}
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ComponentContextHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java?view=auto&rev=448643
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java (added)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java Thu Sep 21 12:35:18 2006
@@ -0,0 +1,66 @@
+/*
+ * 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 java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectorInstanceContext;
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectorInstanceContextImpl;
+import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
+import org.mortbay.jetty.handler.AbstractHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InstanceContextHandler extends AbstractImmutableHandler {
+
+ private final Set unshareableResources;
+ private final Set applicationManagedSecurityResources;
+ private final TrackedConnectionAssociator trackedConnectionAssociator;
+
+ public InstanceContextHandler(AbstractHandler next, Set unshareableResources, Set applicationManagedSecurityResources, TrackedConnectionAssociator trackedConnectionAssociator) {
+ super(next);
+ this.unshareableResources = unshareableResources;
+ this.applicationManagedSecurityResources = applicationManagedSecurityResources;
+ this.trackedConnectionAssociator = trackedConnectionAssociator;
+ }
+
+ public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException {
+ try {
+ ConnectorInstanceContext oldContext = trackedConnectionAssociator.enter(new ConnectorInstanceContextImpl(unshareableResources, applicationManagedSecurityResources));
+
+ try {
+ next.handle(target, request, response, dispatch);
+ } finally {
+ trackedConnectionAssociator.exit(oldContext);
+ }
+ } catch (ResourceException e) {
+ throw new ServletException(e);
+ }
+ }
+
+}
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/JettySecurityHandler.java (from r448418, geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettySecurityHandler.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/JettySecurityHandler.java?view=diff&rev=448643&p1=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettySecurityHandler.java&r1=448418&p2=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/JettySecurityHandler.java&r2=448643
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettySecurityHandler.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/JettySecurityHandler.java Thu Sep 21 12:35:18 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty6;
+package org.apache.geronimo.jetty6.handler;
import java.io.IOException;
import java.security.AccessControlContext;
@@ -38,6 +38,9 @@
import org.apache.geronimo.security.SubjectId;
import org.apache.geronimo.security.deploy.DefaultPrincipal;
import org.apache.geronimo.security.util.ConfigurationUtil;
+import org.apache.geronimo.jetty6.JAASJettyPrincipal;
+import org.apache.geronimo.jetty6.JAASJettyRealm;
+import org.apache.geronimo.jetty6.JettyContainer;
import org.mortbay.jetty.HttpException;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Response;
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/JettySecurityHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/JettySecurityHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/JettySecurityHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java?view=auto&rev=448643
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java (added)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java Thu Sep 21 12:35:18 2006
@@ -0,0 +1,54 @@
+/*
+ * 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.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.handler.AbstractHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ThreadClassloaderHandler extends AbstractImmutableHandler {
+
+ private final ClassLoader classLoader;
+
+ public ThreadClassloaderHandler(AbstractHandler next, ClassLoader classLoader) {
+ super(next);
+ this.classLoader = classLoader;
+ }
+
+ public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException {
+ Thread thread = Thread.currentThread();
+ ClassLoader oldClassLoader = thread.getContextClassLoader();
+ thread.setContextClassLoader(classLoader);
+ try {
+ next.handle(target, request, response, dispatch);
+ } finally {
+ thread.setContextClassLoader(oldClassLoader);
+ }
+ }
+
+}
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/ThreadClassloaderHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain