switch ContextHandler -> ServletContextHandler

I tried to do what RingoJs does...
This commit is contained in:
Simon Oberhammer 2012-03-20 14:00:30 +01:00 committed by Tobi Schäfer
parent 892078eb4e
commit 503005eac8

View file

@ -22,6 +22,7 @@ import helma.framework.repository.FileRepository;
import helma.util.StringUtils; import helma.util.StringUtils;
import org.apache.xmlrpc.XmlRpcHandler; import org.apache.xmlrpc.XmlRpcHandler;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.ResourceHandler; import org.eclipse.jetty.server.handler.ResourceHandler;
@ -304,7 +305,7 @@ public class ApplicationManager implements XmlRpcHandler {
Application app; Application app;
private ContextHandler staticContext = null; private ContextHandler staticContext = null;
private ContextHandler appContext = null; private ServletContextHandler appContext = null;
String appName; String appName;
File appDir; File appDir;
@ -500,17 +501,14 @@ public class ApplicationManager implements XmlRpcHandler {
staticContext.start(); staticContext.start();
} }
appContext = context.addContext(pathPattern, ""); appContext = new ServletContextHandler(context, pathPattern);
ServletHandler handler = new ServletHandler();
Class servletClass = servletClassName == null ? Class servletClass = servletClassName == null ?
EmbeddedServletClient.class : Class.forName(servletClassName); EmbeddedServletClient.class : Class.forName(servletClassName);
ServletHolder holder = new ServletHolder(servletClass); ServletHolder holder = new ServletHolder(servletClass);
handler.addServletWithMapping(holder, "/*"); appContext.addServlet(holder, "/*");
holder.setInitParameter("application", appName); holder.setInitParameter("application", appName);
// holder.setInitParameter("mountpoint", mountpoint);
if (cookieDomain != null) { if (cookieDomain != null) {
holder.setInitParameter("cookieDomain", cookieDomain); holder.setInitParameter("cookieDomain", cookieDomain);
@ -536,8 +534,6 @@ public class ApplicationManager implements XmlRpcHandler {
holder.setInitParameter("debug", debug); holder.setInitParameter("debug", debug);
} }
appContext.setHandler(handler);
if (protectedStaticDir != null) { if (protectedStaticDir != null) {
File protectedContent = getAbsoluteFile(protectedStaticDir); File protectedContent = getAbsoluteFile(protectedStaticDir);
appContext.setResourceBase(protectedContent.getPath()); appContext.setResourceBase(protectedContent.getPath());