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); ContextHandler context = new ContextHandler(); context.setContextPath("/"); context.setResourceBase("."); context.setClassLoader(Thread.currentThread().getContextClassLoader()); context.setHandler(new JettyObjectHandler(object)); server.setHandler(context); server.start(); }
chJavadoc.setResourceBase("jar:" + javadocJar.toURI() + "!/");
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(); }
chJavadoc.setResourceBase("jar:" + javadocJar.toURI() + "!/");
/** Add a context handler. * @param contextPath The context path to add * @param resourceBase the base (root) Resource * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.getDeclaredConstructor().newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
/** Add a context handler. * @param contextPath The context path to add * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
/** Add a context handler. * @param contextPath The context path to add * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
/** Add a context handler. * @param contextPath The context path to add * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
/** Add a context handler. * @param contextPath The context path to add * @param resourceBase the base (root) Resource * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
/** Add a context handler. * @param contextPath The context path to add * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
/** Add a context handler. * @param contextPath The context path to add * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
/** Add a context handler. * @param contextPath The context path to add * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
/** Add a context handler. * @param contextPath The context path to add * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
/** Add a context handler. * @param contextPath The context path to add * @return the ContextHandler just added */ public ContextHandler addContext(String contextPath,String resourceBase) { try { ContextHandler context = _contextClass.newInstance(); context.setContextPath(contextPath); context.setResourceBase(resourceBase); addHandler(context); return context; } catch (Exception e) { LOG.debug(e); throw new Error(e); } }
public WebServer(int port, String resRoot){ super(port); LOG.info("Port:{}, Resources Root:{}", port, resRoot); ResourceHandler rh0 = new ResourceHandler(); ContextHandler context0 = new ContextHandler(); context0.setContextPath("/res/*"); context0.setResourceBase(resRoot); context0.setHandler(rh0); //ServletHandler context1 = new ServletHandler(); //this.setHandler(context1); ServletContextHandler context1 = new ServletContextHandler(); context1.addServlet(TestSlaveServlet.class, "/slavesite/*"); // Create a ContextHandlerCollection and set the context handlers to it. // This will let jetty process urls against the declared contexts in // order to match up content. ContextHandlerCollection contexts = new ContextHandlerCollection(); contexts.setHandlers(new Handler[] { context1, context0}); this.setHandler(contexts); }
contextHandler.setResourceBase("."); contextHandler.setClassLoader(Thread.currentThread().getContextClassLoader()); contextHandler.setHandler(new HelloHandler("")); contextHandler2.setResourceBase("."); contextHandler2.setClassLoader(Thread.currentThread().getContextClassLoader()); contextHandler2.setHandler(new HelloHandler("2"));
homeContext.setResourceBase(homeWarDir.toString()); homeContext.setHandler(homeResourceHandler); homeContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false"); instanceContext.setResourceBase(instanceWarDir.toString()); instanceContext.setHandler(instanceResourceHandler); homeContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
homeContext.setResourceBase(homeWarDir.toString()); homeContext.setHandler(homeResourceHandler); homeContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false"); instanceContext.setResourceBase(instanceWarDir.toString()); instanceContext.setHandler(instanceResourceHandler); homeContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
ContextHandler context = new ContextHandler(); context.setContextPath(""); context.setResourceBase("."); context.setHandler(defaultJettyServiceHandler); handlerCollection.addHandler(context);