root.setResourceBase(staticDir); final ServletHolder indexRedirect = new ServletHolder(new IndexRedirectServlet(defaultServletPath));
/** * @param resourceBase * @see org.mortbay.jetty.handler.ContextHandler#setResourceBase(java.lang.String) */ public void setResourceBase(String resourceBase) { _context.setResourceBase(resourceBase); }
Server server = new Server(8080); Context root = new Context(server, "/"); root.setResourceBase("./pom.xml"); root.setHandler(new ResourceHandler()); server.start();
/** * Add default apps. * @param appDir The application directory * @throws IOException */ protected void addDefaultApps(ContextHandlerCollection parent, final String appDir) throws IOException { // set up the context for "/logs/" if "hadoop.log.dir" property is defined. String logDir = System.getProperty("hadoop.log.dir"); if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(DefaultServlet.class, "/"); defaultContexts.put(logContext, true); } // set up the context for "/static/*" Context staticContext = new Context(parent, "/static"); staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); defaultContexts.put(staticContext, true); }
/** * Add default apps. * * @param appDir The application directory * @throws IOException */ protected void addDefaultApps(ContextHandlerCollection parent, final String appDir) throws IOException { // set up the context for "/logs/" if "hama.log.dir" property is defined. String logDir = System.getProperty("hama.log.dir"); if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(DefaultServlet.class, "/"); defaultContexts.put(logContext, true); } // set up the context for "/static/*" Context staticContext = new Context(parent, "/static"); staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); defaultContexts.put(staticContext, true); // set up the context for "/commons/*" Context commonsContext = new Context(parent, "/commons"); commonsContext.setResourceBase(appDir + "/commons"); commonsContext.addServlet(DefaultServlet.class, "/*"); defaultContexts.put(commonsContext, true); }
/** * Add default apps. * * @param appDir The application directory * @throws IOException */ protected void addDefaultApps(ContextHandlerCollection parent, final String appDir) throws IOException { // set up the context for "/logs/" if "hama.log.dir" property is defined. String logDir = System.getProperty("hama.log.dir"); if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(DefaultServlet.class, "/"); defaultContexts.put(logContext, true); } // set up the context for "/static/*" Context staticContext = new Context(parent, "/static"); staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); defaultContexts.put(staticContext, true); // set up the context for "/commons/*" Context commonsContext = new Context(parent, "/commons"); commonsContext.setResourceBase(appDir + "/commons"); commonsContext.addServlet(DefaultServlet.class, "/*"); defaultContexts.put(commonsContext, true); }
/** * Add default apps. * * @param appDir * The application directory * @throws IOException */ protected void addDefaultApps(ContextHandlerCollection parent, final String appDir, Configuration conf) throws IOException { // set up the context for "/logs/" if "hadoop.log.dir" property is defined. String logDir = System.getProperty("tajo.log.dir"); if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); //logContext.addServlet(AdminAuthorizedServlet.class, "/*"); logContext.setDisplayName("logs"); defaultContexts.put(logContext, true); } // set up the context for "/static/*" Context staticContext = new Context(parent, "/static"); staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static"); defaultContexts.put(staticContext, true); }
new Context((ContextHandlerCollection)this.webServer.getHandler(), logsContextPath); logContext.setResourceBase(logDir); logContext.addServlet(DefaultServlet.class, "/"); defaultContexts.put(logContext, true);
new Context((ContextHandlerCollection)this.webServer.getHandler(), logsContextPath); logContext.setResourceBase(logDir); logContext.addServlet(DefaultServlet.class, "/"); defaultContexts.put(logContext, true);
/** * Add default apps. * * @param appDir * The application directory * @throws IOException */ protected void addDefaultApps(ContextHandlerCollection parent, final String appDir, Configuration conf) throws IOException { // set up the context for "/logs/" if "hadoop.log.dir" property is defined. String logDir = System.getProperty("tajo.log.dir"); if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); //logContext.addServlet(AdminAuthorizedServlet.class, "/*"); logContext.setDisplayName("logs"); defaultContexts.put(logContext, true); } // set up the context for "/static/*" Context staticContext = new Context(parent, "/static"); staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static"); defaultContexts.put(staticContext, true); }
if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/"); if (conf.getBoolean( staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static");
if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/*"); if (conf.getBoolean( staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static");
if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/*"); if (conf.getBoolean( staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static");
if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/*"); if (conf.getBoolean( staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static");
if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/*"); if (conf.getBoolean( staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static");
if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/*"); if (conf.getBoolean( staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static");
if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/*"); if (conf.getBoolean( staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static");
if (logDir != null) { Context logContext = new Context(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/*"); if (conf.getBoolean( staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static");
public ContextHandler getServletContext( Servlet servlet, ContextHandlerCollection contextHandlerCollection ) throws Exception { org.mortbay.jetty.servlet.Context servletContext = new org.mortbay.jetty.servlet.Context( contextHandlerCollection, servlet.getContextPath(), org.mortbay.jetty.servlet.Context.SESSIONS ); // Put the container for the application into the servlet context PlexusContainer container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY ); servletContext.setAttribute( PlexusConstants.PLEXUS_KEY, container ); servletContext.setResourceBase( servlet.getResourceBase() ); //servletContext.setContextPath( servlet.getContextPath() ); servletContext.addServlet( new ServletHolder( (javax.servlet.Servlet)servlet.instantiate( context ) ), "/*" ); //context.setAttribute( "resourceCollectionHint", fileCollectionHint ); //context.setAttribute( "debug", debugLevel+"" ); //Map<String,String> initParams = new HashMap<String, String>(8); //initParams.put( "resourceCollectionHint", fileCollectionHint ); //initParams.put( "debug", debugLevel+"" ); //context.setInitParams( initParams ); return servletContext; }
protected Context getContext() { if (getWebAppcontextPath() != null) { m_context = new WebAppContext( null,ConfigUtils .getInitialPropertyExpanded(getContextPath())); m_context.setResourceBase(getResourceBase()); getContexts().addHandler(m_context); getServer().setHandler(getContexts()); } else if (m_context == null) { getServer().setHandler(getContexts()); m_context = new Context(m_contexts, getContextPath(), Context.SESSIONS); if (getResourceBase() != null) { m_context.setResourceBase(getResourceBase()); } } return m_context; }