Mercurial Hosting > nabble
diff src/global/GlobalJetty.java @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/global/GlobalJetty.java Thu Mar 21 19:15:52 2019 -0600 @@ -0,0 +1,32 @@ +package global; + +import nabble.view.lib.JtpContextServlet; +import nabble.utils.Jetty; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import nabble.utils.LuanServlet; + +import java.net.MalformedURLException; + +public class GlobalJetty extends Jetty { + + public ServletContextHandler newWebContext() + throws MalformedURLException + { + ServletContextHandler context = newContext("/", "global/web/Index.class"); + + newServletHolder( new LuanServlet("classpath:global/web"), context, new String[]{"*.luan"} ); + + JtpContextServlet jtpContext = new JtpContextServlet(); + jtpContext.setBase("global.web"); + jtpContext.setUrlMapper( UrlMapperImpl.INSTANCE ); + jtpContext.setHttpCache( WebCache.INSTANCE ); + + ServletHolder sh = newServletHolder(jtpContext, context, new String[] { "/", "*.jtp" }); + sh.setInitParameter("cache","false"); + addDefaultServlet(context); + + return context; + } + +}