Version: Merlin SMP 3.0 Build: 20031115 Environment: Mac OS X 10.2.8 Java 1.4.1_01
The problems I had where in the JettyWebServer implementation. The service resolution is made with the full class name. I updated it to use the key "session-manager" which point to my own implementation of SessionManager (which extends AvalonSessionManager). From there, everything work. Attach a sample of what I did:
Index: JettyWebServer.java
===================================================================
RCS file:
/home/cvspublic/avalon/merlin/web/http/impl/src/java/org/apache/avalon/merlin/http/JettyWebServer.java,v
retrieving revision 1.2
diff -u -r1.2 JettyWebServer.java
--- JettyWebServer.java 13 Nov 2003 01:56:42 -0000 1.2
+++ JettyWebServer.java 16 Nov 2003 22:49:18 -0000
@@ -195,7 +195,7 @@
* @throws <code>ServiceException</code> if an error occurs while servicing
* this component
*
- * @avalon.dependency type="org.mortbay.jetty.servlet.SessionManager"
+ * @avalon.dependency type="org.mortbay.jetty.servlet.SessionManager"
key="session-manager"
* @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
*/
public void service(ServiceManager manager) throws ServiceException {
@@ -547,6 +547,7 @@
);
}
context.setResourceBase(m_basedir + "/" +
conf.getAttribute(CFG_CONTEXT_NAME));
+ this.getLogger().info( "load context: "+ m_basedir + "/" +
conf.getAttribute(CFG_CONTEXT_NAME) );
context.addHandler(new ResourceHandler());
} catch (Exception e) {
m_logger.error("Could not construct context", e);
@@ -565,6 +566,8 @@
conf.getAttribute(CFG_CONTEXT_NAME, ""),
new File(m_basedir, conf.getAttribute(CFG_CONTEXT_PATH,
"")).toString()
);
+ this.getLogger().info( "load web application context: " + m_basedir + "
// "
+ + conf.getAttribute(CFG_CONTEXT_PATH, "") );
}
}
@@ -606,7 +609,7 @@
// due to class cast exception - some rethingking needed here
String clazzName = SessionManager.class.getName();
- SessionManager sessionManager = (SessionManager)
m_serviceManager.lookup(clazzName) ;
+ SessionManager sessionManager = (SessionManager)
m_serviceManager.lookup("session-manager") ;
servletHandler.setSessionManager( sessionManager );
return servletHandler;
@@ -639,9 +642,9 @@
}
wac.setContextPath("/" + contextName + "/*");
String clazzName =
org.apache.avalon.merlin.http.SessionManager.class.getName();
- wac.getServletHandler().setSessionManager((SessionManager)
m_serviceManager.lookup(clazzName));
+ wac.getServletHandler().setSessionManager((SessionManager)
m_serviceManager.lookup("session-manager"));
} catch (Exception e) {
- m_logger.error("Failed to load context: " + contextName);
+ m_logger.error("Failed to load context: " + contextName, e);
return;
}
m_httpServer.addContext(wac);
I also add the debug and admin servlet provided by Jetty for development purposes:
<Context name="admin" path="/">
<Servlet name="Admin" path="/" classname="org.mortbay.servlet.AdminServlet"/>
<Servlet name="Debug" path="/Debug/" classname="org.mortbay.servlet.Debug"/>
</Context>
Note, there seems to be a problem with the resolution of absolute web context path. something line "/myWebApp" will be resolve as "${jetty.component.home}/myWebApp"
I'll be happy to work on a simple Maverick based demo app and some test cases. Stephen mentioned some potential changes, so i'll wait until the component api is fairly stable.
d.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
