public IgnoredStandardContext() { setJarScanner(new EmptyScanner()); // Tomcat has a stupid rule where a life cycle listener must set // configured true, or it will treat it as a failed deployment addLifecycleListener(new LifecycleListener() { public void lifecycleEvent(final LifecycleEvent event) { final Context context = Context.class.cast(event.getLifecycle()); if (event.getType().equals(Lifecycle.START_EVENT) || event.getType().equals(Lifecycle.BEFORE_START_EVENT) || event.getType().equals(Lifecycle.CONFIGURE_START_EVENT)) { context.setConfigured(true); } } }); } }
@Override protected void startInternal() throws LifecycleException { addServletContainerInitializer(new WsSci(), Collections.<Class<?>>singleton(LiveReloadEndpoint.class)); super.startInternal(); } }
@Override protected void initInternal() throws LifecycleException { super.initInternal(); final Wrapper servlet = createWrapper(); servlet.setName(ServerServlet.class.getSimpleName()); servlet.setServletClass(ServerServlet.class.getName()); addChild(servlet); addServletMappingDecoded(MAPPING, ServerServlet.class.getSimpleName()); } }
@Override protected void initInternal() throws LifecycleException { super.initInternal(); {// fake/not really desired "/*" servlet to ensure in context valve we match the request and got to WS filter final Wrapper servlet = createWrapper(); servlet.setName(DefaultServlet.class.getSimpleName()); servlet.setServletClass(DefaultServlet.class.getName()); addChild(servlet); addServletMappingDecoded("/*", DefaultServlet.class.getSimpleName()); } {// the js injected in the page final Wrapper servlet = createWrapper(); servlet.setName(LiveReloadJs.class.getSimpleName()); servlet.setServletClass(LiveReloadJs.class.getName()); addChild(servlet); addServletMappingDecoded("/livereload.js", LiveReloadJs.class.getSimpleName()); } }