if (adminContextDir == null) adminContextDir = appDir + "/WEB-INF/lib/railo-server";
System.out.println("appdir:" + appDir);
System.out.println("webcontext:" + webContextDir);
System.out.println("servercontext:" + adminContextDir);
HttpContext context = new HttpContext();
//context.setClassLoader(new ContextClassloader());
context.setContextPath(strContext);
context.addWelcomeFile("index.cfm");
if ( host != null && !host.isEmpty() )
context.addVirtualHost(host);
//context.setClassPath(lib);
server.addContext(context);
// Create a servlet container
ServletHandler servlets = new ServletHandler();
context.addHandler(servlets);
// Map a servlet onto the container
ServletHolder servlet = servlets.addServlet("CFMLServlet", "*.cfc/*,*.cfm/*,*.cfml/*,*.cfc,*.cfm,*.cfml", "railo.debug.loader.servlet.CFMLServlet");
servlet.setInitOrder(0);
if (adminContextDir == null) webContextDir = appDir;
servlet.setInitParameter("railo-server-directory", adminContextDir);
servlet.setInitParameter("railo-web-directory", webContextDir);
// Uncomment line below to debug Railo REST Servlet
//servlet = servlets.addServlet("RESTServlet", "/rest/*", "railo.debug.loader.servlet.RESTServlet");
//servlet = servlets.addServlet("FileServlet","/","servlet.FileServlet");
/* Uncomment to add remote flash support; toggle block comment by adding/removing a '/' at the beginning of this line
servlet = servlets.addServlet("openamf","/flashservices/gateway/*,/openamf/gateway/*","servlet.AMFServlet");
servlet = servlets.addServlet("openamf","/openamf/gateway/*","railo.loader.servlet.AMFServlet");
servlet = servlets.addServlet("MessageBrokerServlet","/flashservices/gateway/*,/messagebroker/*,/flex2gateway/*","flex.messaging.MessageBrokerServlet");
servlet.setInitParameter("services.configuration.file", "/WEB-INF/flex/services-config.xml");
//*/
appDir += path;
context.setResourceBase(appDir);
context.addHandler(new ResourceHandler());
}