@Override public void start() { writeTimeToFile("startingAt"); ContextHandler context = new ContextHandler(); context.setContextPath("/"); context.setClassLoader(Thread.currentThread().getContextClassLoader()); server.setHandler(context); context.setHandler(new AbstractHandler() { @Override public void handle(String target, Request request, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException { if ("/ping".equals(target)) { request.setHandled(true); httpServletResponse.getWriter().print("ping"); } else if ("/restart".equals(target)) { writeTimeToFile("restartAskedAt"); request.setHandled(true); processCommands.askForRestart(); httpServletResponse.getWriter().print("ok"); } else if ("/kill".equals(target)) { writeTimeToFile("killedAt"); System.exit(0); } } }); try { server.start(); } catch (Exception e) { throw new IllegalStateException("Fail to start Jetty", e); } }
sendGcodeContext.setContextPath("/sendGcode"); sendGcodeContext.setBaseResource(getBaseResource()); sendGcodeContext.setClassLoader(Thread.currentThread().getContextClassLoader()); sendGcodeContext.setHandler(new SendGcodeHandler()); adjustManualLocationContext.setContextPath("/adjustManualLocation"); adjustManualLocationContext.setBaseResource(getBaseResource()); adjustManualLocationContext.setClassLoader(Thread.currentThread().getContextClassLoader()); adjustManualLocationContext.setHandler(new AdjustManualLocationHandler()); getSystemStateContext.setContextPath("/getSystemState"); getSystemStateContext.setBaseResource(getBaseResource()); getSystemStateContext.setClassLoader(Thread.currentThread().getContextClassLoader()); getSystemStateContext.setHandler(new GetSystemStateHandler()); configContext.setContextPath("/config"); configContext.setBaseResource(getBaseResource()); configContext.setClassLoader(Thread.currentThread().getContextClassLoader()); configContext.setHandler(new ConfigHandler()); configContext.setInitParameter("cacheControl", "max-age=0, public");
public void start() throws Exception { server = new Server(port); ContextHandlerCollection contexts = new ContextHandlerCollection(); server.setHandler(contexts); ContextHandler context = new ContextHandler(); context.setContextPath("/"); context.setResourceBase("."); context.setClassLoader(Thread.currentThread().getContextClassLoader()); server.setHandler(context); server.start(); }
public void start() throws Exception { server = new Server(port); ContextHandlerCollection contexts = new ContextHandlerCollection(); server.setHandler(contexts); ContextHandler context = new ContextHandler(); context.setContextPath("/"); context.setResourceBase("."); context.setClassLoader(Thread.currentThread().getContextClassLoader()); context.setHandler(new JettyIndexHandler(index)); server.setHandler(context); server.start(); }
public void start() throws Exception { server = new Server(port); ContextHandler context = new ContextHandler(); context.setContextPath("/"); context.setResourceBase("."); context.setClassLoader(Thread.currentThread().getContextClassLoader()); context.setHandler(new JettyObjectHandler(object)); server.setHandler(context); server.start(); }
contextHandler.setContextPath("/hello"); contextHandler.setResourceBase("."); contextHandler.setClassLoader(Thread.currentThread().getContextClassLoader()); contextHandler.setHandler(new HelloHandler("")); contextHandler2.setContextPath("/hello2"); contextHandler2.setResourceBase("."); contextHandler2.setClassLoader(Thread.currentThread().getContextClassLoader()); contextHandler2.setHandler(new HelloHandler("2"));
_contextHandler.setClassLoader(classLoader);
context1.setWelcomeFiles(new String[]{"index.html"}); context1.setResourceBase(config.resource()); context1.setClassLoader(Thread.currentThread().getContextClassLoader()); context1.setVirtualHosts(config.vhosts());
context1.setWelcomeFiles(new String[]{"index.html"}); context1.setResourceBase(config.resource()); context1.setClassLoader(Thread.currentThread().getContextClassLoader()); context1.setVirtualHosts(config.vhosts());