當前位置: 首頁>>代碼示例>>Java>>正文


Java ContextHandlerCollection類代碼示例

本文整理匯總了Java中org.mortbay.jetty.handler.ContextHandlerCollection的典型用法代碼示例。如果您正苦於以下問題:Java ContextHandlerCollection類的具體用法?Java ContextHandlerCollection怎麽用?Java ContextHandlerCollection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ContextHandlerCollection類屬於org.mortbay.jetty.handler包,在下文中一共展示了ContextHandlerCollection類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8081 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/reporting" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );

    server.start();
    server.join();
}
 
開發者ID:opensagres,項目名稱:xdocreport.samples,代碼行數:18,代碼來源:EmbeddedServer.java

示例2: configureHandlers

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * Set up the handler structure to receive a webapp. Also put in a DefaultHandler so we get a nice page than a 404
 * if we hit the root and the webapp's context isn't at root.
 */
public void configureHandlers() throws Exception {
    this.defaultHandler = new DefaultHandler();
    this.requestLogHandler = new RequestLogHandler();
    if (this.requestLog != null) {
        this.requestLogHandler.setRequestLog(this.requestLog);
    }

    this.contexts = (ContextHandlerCollection) server.getChildHandlerByClass(ContextHandlerCollection.class);
    if (this.contexts == null) {
        this.contexts = new ContextHandlerCollection();
        this.handlers = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
        if (this.handlers == null) {
            this.handlers = new HandlerCollection();
            this.server.setHandler(handlers);
            this.handlers.setHandlers(new Handler[]{this.contexts, this.defaultHandler, this.requestLogHandler});
        } else {
            this.handlers.addHandler(this.contexts);
        }
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:25,代碼來源:Jetty6PluginServer.java

示例3: main

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8080 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/xdocreport-webapp" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );

    // JSP Servlet + Context
    Context jsp_ctx = new Context( servlet_contexts, "/jsp", Context.SESSIONS );
    jsp_ctx.addServlet( new ServletHolder( new org.apache.jasper.servlet.JspServlet() ), "*.jsp" );

    server.start();
    server.join();
}
 
開發者ID:DistX,項目名稱:Learning,代碼行數:22,代碼來源:EmbeddedServer.java

示例4: addDefaultApps

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * 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(StaticServlet.class, "/");
    defaultContexts.put(logContext, true);
  }
  // set up the context for "/static/*"
  Context staticContext = new Context(parent, "/static");
  staticContext.setResourceBase(appDir + "/static");
  staticContext.addServlet(StaticServlet.class, "/*");
  defaultContexts.put(staticContext, true);
}
 
開發者ID:rhli,項目名稱:hadoop-EAR,代碼行數:22,代碼來源:HttpServer.java

示例5: addDefaultApps

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:apache,項目名稱:tajo,代碼行數:26,代碼來源:HttpServer.java

示例6: startServer

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * Starts the jetty web server.
 * @return true on successful start.
 */
public boolean startServer() {
    if (server != null && server.isRunning()) {
        return true;
    } else {
        server = new Server(port);
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        server.setHandler(contexts);

        Context mjpg = new Context(contexts, MPEG, Context.SESSIONS);
        mjpg.addServlet(new ServletHolder(new AxisServlet()), "/*");
        
        try {
            server.start();
            return true;
        } catch (Exception e1) {
            log.error("Could not start server", e1);
        }
    }
    return false;
}
 
開發者ID:Comcast,項目名稱:cats,代碼行數:25,代碼來源:JettyAxisCameraServer.java

示例7: addDefaultApps

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * 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(AdminAuthorizedServlet.class, "/");
    logContext.setDisplayName("logs");
    setContextAttributes(logContext);
    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");
  setContextAttributes(staticContext);
  defaultContexts.put(staticContext, true);
}
 
開發者ID:Seagate,項目名稱:hadoop-on-lustre,代碼行數:26,代碼來源:HttpServer.java

示例8: testStopWebAppCtx

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
public void testStopWebAppCtx() throws Exception {
	final boolean[] stopped = new boolean[1];

	Server tempServer = new Server() {

		public Handler getChildHandlerByClass(Class byclass) {
			if (ContextHandlerCollection.class.equals(byclass))
				return null;
			assertEquals(HandlerCollection.class, byclass);
			return new HandlerCollection();
		}
	};

	BundleContext bundleCtx = new MockBundleContext();
	String contextPath = "/path";
	deployer.setServer(tempServer);
	deployer.afterPropertiesSet();
	WarDeployment deployment = deployer.createDeployment(bundleCtx.getBundle(), contextPath);
	deployment.undeploy();
}
 
開發者ID:BeamFoundry,項目名稱:spring-osgi,代碼行數:21,代碼來源:JettyWarDeployerTest.java

示例9: addDefaultApps

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:iVCE,項目名稱:RDFS,代碼行數:22,代碼來源:HttpServer.java

示例10: createHttpServer

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
@Override
 public HttpServer createHttpServer(InetSocketAddress addr, int backlog)
         throws IOException
 {
     Server server = _server;
 	boolean noServerCleanUp = true;
     if (server == null)
     {
     	server = new Server();
     	
     	HandlerCollection handlerCollection = new HandlerCollection();
     	handlerCollection.setHandlers(new Handler[] {new ContextHandlerCollection(), new DefaultHandler()});
server.setHandler(handlerCollection);
     	
     	noServerCleanUp = false;
     }

     JettyHttpServer jettyHttpServer = new JettyHttpServer(server, noServerCleanUp);
     jettyHttpServer.bind(addr, backlog);
     return jettyHttpServer;
 }
 
開發者ID:ZarGate,項目名稱:OpenbravoPOS,代碼行數:22,代碼來源:JettyHttpServerProvider.java

示例11: addDefaultApps

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * 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("hadoop.log.dir");
  if (logDir != null) {
    Context logContext = new Context(parent, "/logs");
    logContext.setResourceBase(logDir);
    logContext.addServlet(AdminAuthorizedServlet.class, "/*");
    if (conf.getBoolean(
        CommonConfigurationKeys.HADOOP_JETTY_LOGS_SERVE_ALIASES,
        CommonConfigurationKeys.DEFAULT_HADOOP_JETTY_LOGS_SERVE_ALIASES)) {
      logContext.getInitParams().put(
          "org.mortbay.jetty.servlet.Default.aliases", "true");
    }
    logContext.setDisplayName("logs");
    setContextAttributes(logContext, conf);
    addNoCacheFilter(webAppContext);
    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");
  setContextAttributes(staticContext, conf);
  defaultContexts.put(staticContext, true);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:33,代碼來源:HttpServer.java

示例12: addDefaultApps

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * 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("hadoop.log.dir");
  if (logDir != null) {
    Context logContext = new Context(parent, "/logs");
    logContext.setResourceBase(logDir);
    logContext.addServlet(AdminAuthorizedServlet.class, "/*");
    if (conf.getBoolean(
        CommonConfigurationKeys.HADOOP_JETTY_LOGS_SERVE_ALIASES,
        CommonConfigurationKeys.DEFAULT_HADOOP_JETTY_LOGS_SERVE_ALIASES)) {
      @SuppressWarnings("unchecked")
      Map<String, String> params = logContext.getInitParams();
      params.put(
          "org.mortbay.jetty.servlet.Default.aliases", "true");
    }
    logContext.setDisplayName("logs");
    setContextAttributes(logContext, conf);
    addNoCacheFilter(webAppContext);
    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");
  setContextAttributes(staticContext, conf);
  defaultContexts.put(staticContext, true);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:35,代碼來源:HttpServer2.java

示例13: addDefaultApps

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * 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 = this.logDir;
  if (logDir == null) {
      logDir = System.getProperty("hadoop.log.dir");
  }
  if (logDir != null) {
    Context logContext = new Context(parent, "/logs");
    logContext.setResourceBase(logDir);
    logContext.addServlet(AdminAuthorizedServlet.class, "/*");
    if (conf.getBoolean(
        ServerConfigurationKeys.HBASE_JETTY_LOGS_SERVE_ALIASES,
        ServerConfigurationKeys.DEFAULT_HBASE_JETTY_LOGS_SERVE_ALIASES)) {
      @SuppressWarnings("unchecked")
      Map<String, String> params = logContext.getInitParams();
      params.put(
          "org.mortbay.jetty.servlet.Default.aliases", "true");
    }
    logContext.setDisplayName("logs");
    setContextAttributes(logContext, conf);
    addNoCacheFilter(webAppContext);
    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");
  setContextAttributes(staticContext, conf);
  defaultContexts.put(staticContext, true);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:38,代碼來源:HttpServer.java

示例14: createApplicationContext

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
/**
 * @see com.sabre.ant.jetty.WebApplicationProxy#createApplicationContext(org.mortbay.jetty.handler.ContextHandlerCollection)
 */
public void createApplicationContext(ContextHandlerCollection contexts)
{
    webAppContext = new WebAppContext(contexts, warFile.getAbsolutePath(), contextPath);
    webAppContext.setDisplayName(name);

    configurePaths();
    configureHandlers(contexts);

    applyConfiguration();
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:14,代碼來源:WebApplicationProxyImpl.java

示例15: configureHandlers

import org.mortbay.jetty.handler.ContextHandlerCollection; //導入依賴的package包/類
private void configureHandlers(ContextHandlerCollection contexts)
{
    // adding extra context handlers
    Iterator handlersIterator = contextHandlers.iterator();
    while (handlersIterator.hasNext())
    {
        ContextHandler contextHandler = (ContextHandler) handlersIterator.next();
        contexts.addHandler(contextHandler);
    }
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:11,代碼來源:WebApplicationProxyImpl.java


注:本文中的org.mortbay.jetty.handler.ContextHandlerCollection類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。