@Override protected void startContext() throws Exception { super.startContext(); setServer(server); webXmlConfiguration.configure(url.toString()); } };
"Failed to find resource '%s'", resourcePath ); ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setWelcomeFiles(new String[]{ "workflow.html" }); resourceHandler.setResourceBase(resourceUrl.toExternalForm()); HandlerList handler = new HandlerList(); handler.setHandlers(new Handler[] { resourceHandler, new APIHandler(workflowIndexReadService, statsReadService), new DefaultHandler() });
@Before public void setupLocalServer() throws Exception { // Set up a local Jetty HTTP server Server server = new Server(); server.addConnector(new SocketConnector()); ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setResourceBase("src/test/resources/server"); server.addHandler(resourceHandler); server.start(); // The server will have a random port assigned, so capture that localPort = server.getConnectors()[0].getLocalPort(); }
public void doStart() throws Exception { SContext scontext = ContextHandler.getCurrentContext(); _context = (scontext==null?null:scontext.getContextHandler()); super.doStart(); }
protected ContextHandlerCollection getContexts() { if (m_contexts == null) m_contexts = new ContextHandlerCollection(); return m_contexts; }
public static ContextHandler getCurrentWebAppContext() { ContextHandler.SContext context=ContextHandler.getCurrentContext(); if (context!=null) { ContextHandler handler = context.getContextHandler(); if (handler instanceof WebAppContext) return (ContextHandler)handler; } return null; }
public void setHandlers(Handler[] handlers) { _contextMap=null; super.setHandlers(handlers); if (isStarted()) mapContexts(); }
/** * */ public ContextHandler(String contextPath) { this(); setContextPath(contextPath); }
protected Object expandChildren(Object list, Class byClass) { Handler[] handlers = getHandlers(); for (int i=0;handlers!=null && i<handlers.length;i++) list=expandHandler(handlers[i], list, byClass); return list; }
protected void doStart() throws Exception { super.doStart(); _servletContext=ContextHandler.getCurrentContext(); }
public String getServletContextName() { String name = ContextHandler.this.getDisplayName(); if (name==null) name=ContextHandler.this.getContextPath(); return name; }
protected void doStart() throws Exception { mapContexts(); super.doStart(); }
public MovedContextHandler(HandlerContainer parent, String contextPath, String newContextURL) { super(parent,contextPath); _newContextURL=newContextURL; _redirector=new Redirector(); addHandler(_redirector); }
public String getRealPath(String path) { if (_context==null) return null; return _context.getRealPath(path); }
/** * @deprecated use {@link #setConnectorNames(String[])} */ public void setHosts(String[] hosts) { setConnectorNames(hosts); }
/** Get the hosts for the context. * @deprecated */ public String[] getHosts() { return getConnectorNames(); }
protected void doStop() throws Exception { // TODO Auto-generated method stub super.doStop(); }
public MovedContextHandler() { _redirector=new Redirector(); addHandler(_redirector); }
public String getPathTranslated() { if (_pathInfo==null || _context==null) return null; return _context.getRealPath(_pathInfo); }