You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ja...@apache.org on 2005/12/09 07:11:39 UTC
svn commit: r355389 -
/geronimo/branches/1.0/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
Author: janb
Date: Thu Dec 8 22:11:33 2005
New Revision: 355389
URL: http://svn.apache.org/viewcvs?rev=355389&view=rev
Log:
fixed NPE on deployment of a webapp with WADI as SessionManager
Modified:
geronimo/branches/1.0/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
Modified: geronimo/branches/1.0/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java?rev=355389&r1=355388&r2=355389&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java (original)
+++ geronimo/branches/1.0/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java Thu Dec 8 22:11:33 2005
@@ -107,6 +107,38 @@
private String sessionManager;
+
+ public class SessionManagerConfiguration implements WebApplicationContext.Configuration {
+
+ private WebApplicationContext webAppContext;
+
+
+ public void setWebApplicationContext(WebApplicationContext webAppContext) {
+ this.webAppContext = webAppContext;
+ }
+
+ public WebApplicationContext getWebApplicationContext() {
+ return this.webAppContext;
+ }
+
+ public void configureClassPath() throws Exception {
+ }
+
+ public void configureDefaults() throws Exception {
+ }
+
+
+ public void configureWebApp() throws Exception {
+ //setup a SessionManager
+ if (getSessionManager() != null) {
+ Class clazz = Thread.currentThread().getContextClassLoader().loadClass(getSessionManager());
+ Object o = clazz.newInstance();
+ this.webAppContext.getServletHandler().setSessionManager((SessionManager)o);
+ }
+ }
+
+ }
+
/**
* @deprecated never use this... this is only here because Jetty WebApplicationContext is externalizable
*/
@@ -213,7 +245,7 @@
setClassLoader(this.webClassLoader);
setHosts(virtualHosts);
- this.sessionManager = sessionManager;
+
handler = new WebApplicationHandler();
addHandler(handler);
@@ -268,26 +300,23 @@
} else {
securityInterceptor = null;
}
-//end JACC
+// end JACC
interceptor = new RequestWrappingBeforeAfter(interceptor, handler);
chain = interceptor;
contextLength = index;
-
+
//cheat -- add jsr154 filter not as a gbean
FilterHolder jsr154FilterHolder = new FilterHolder(handler, "jsr154", JSR154Filter.class.getName());
handler.addFilterHolder(jsr154FilterHolder);
jsr154FilterHolder.setInitParameter("unwrappedDispatch", "true");
handler.addFilterPathMapping("/*", "jsr154", Dispatcher.__REQUEST | Dispatcher.__FORWARD | Dispatcher.__INCLUDE | Dispatcher.__ERROR);
-
- //setup a SessionManager
- if (getSessionManager()!=null) {
- Class clazz = Thread.currentThread().getContextClassLoader().loadClass(getSessionManager());
- Object o = clazz.newInstance();
- getServletHandler().setSessionManager((SessionManager)o);
- }
-
+
+ configureSessionManager (sessionManager);
+
}
+
+
public String getObjectName() {
return objectName;
}
@@ -327,7 +356,8 @@
public void doStart() throws Exception {
// reset the classsloader... jetty likes to set it to null when stopping
setClassLoader(webClassLoader);
-
+
+
// merge Geronimo and Jetty Lifecycles
if (!isStarting()) {
super.start();
@@ -487,6 +517,22 @@
}
+ private void configureSessionManager (String sessionManagerClassName) {
+ this.sessionManager = sessionManagerClassName;
+ if (this.sessionManager != null) {
+ addConfiguration (SessionManagerConfiguration.class.getName());
+ }
+ }
+
+ private void addConfiguration (String configClassName) {
+ String[] configClassNames = getConfigurationClassNames();
+ String[] newConfigClassNames = new String[configClassNames==null?1:configClassNames.length+1];
+ for (int i=0;i<configClassNames.length;i++)
+ newConfigClassNames[i] = configClassNames[i];
+
+ newConfigClassNames[newConfigClassNames.length-1] = configClassName;
+ }
+
/**
* ObjectName must match this pattern:
* <p/>