当前位置: 首页>>代码示例>>Java>>正文


Java WebAppContext.setResourceBase方法代码示例

本文整理汇总了Java中org.mortbay.jetty.webapp.WebAppContext.setResourceBase方法的典型用法代码示例。如果您正苦于以下问题:Java WebAppContext.setResourceBase方法的具体用法?Java WebAppContext.setResourceBase怎么用?Java WebAppContext.setResourceBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mortbay.jetty.webapp.WebAppContext的用法示例。


在下文中一共展示了WebAppContext.setResourceBase方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupSolr

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
private void setupSolr() throws Exception {
    FileUtils.deleteQuietly(SOLR_WORK_DIR);
    FileUtils.copyDirectory(new File("src/test/resources/solr/"), SOLR_WORK_DIR);
    String configSolrXml = "<solr>" + "  <solrcloud>" + "    <str name=\"host\">${host:}</str>"
            + "    <int name=\"hostPort\">" + solrPort + "</int>"
            + "    <str name=\"hostContext\">${hostContext:solr}</str>"
            + "    <int name=\"zkClientTimeout\">${zkClientTimeout:300000}</int>"
            + "    <bool name=\"genericCoreNodeNames\">${genericCoreNodeNames:true}</bool>" + "  </solrcloud>"
            + "  <shardHandlerFactory name=\"shardHandlerFactory\"" + "    class=\"HttpShardHandlerFactory\">"
            + "    <int name=\"socketTimeout\">${socketTimeout:0}</int>"
            + "    <int name=\"connTimeout\">${connTimeout:0}</int>" + "  </shardHandlerFactory>" + "</solr>";
    File solrConfig = new File(SOLR_WORK_DIR, "solr.xml");
    OutputStream out = new FileOutputStream(solrConfig);
    out.write(configSolrXml.getBytes("UTF-8"));
    out.close();
    server = new Server(solrPort);

    final WebAppContext context = new WebAppContext();
    context.setResourceBase(SOLR_WORK_DIR.getPath());
    context.setContextPath("/");
    context.setClassLoader(Thread.currentThread().getContextClassLoader());
    System.setProperty("solr.solr.home", SOLR_WORK_DIR.getPath());
    server.setHandler(context);
    server.start();
    jenkinsSearchBackend.setSolrBackend(false, solrPort);
}
 
开发者ID:jenkinsci,项目名称:lucene-search-plugin,代码行数:27,代码来源:SolrSearchBackendTest.java

示例2: setUpBeforeClass

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
	// start the server:
	server = new Server(port);
	WebAppContext context = new WebAppContext();

	uri = "http://localhost:20100";

	// see if this can be set more dynamically:
	context.setContextPath("/");
	context.setResourceBase(new File("src/main/webapp/").getCanonicalPath());
	context.setDescriptor(new File("src/main/webapp/").getCanonicalPath() + "/WEB-INF/web.xml");

	server.setHandler(context);
	server.start();
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:21,代码来源:TemplateCRUDImplTest.java

示例3: setUpBeforeClass

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
	// start the server:
	server = new Server(port);
	WebAppContext context = new WebAppContext();

	uri = "http://localhost:20100";

	// see if this can be set more dynamically:
	context.setContextPath("/");
	context.setResourceBase(new File("src/main/webapp/").getCanonicalPath());
	context.setDescriptor(new File("src/main/webapp/").getCanonicalPath() + "/WEB-INF/web.xml");

	server.setHandler(context);
	server.start();

	ContentProviderCRUD proxy = ProxyFactory.create(ContentProviderCRUD.class, uri);
	proxy.deleteContentProvider(ConstantsTest.CP);
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:24,代码来源:ContentProviderCRUDImplTest.java

示例4: setUpBeforeClass

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception
{

	// start the server:
	server = new Server(port);
	WebAppContext context = new WebAppContext();

	uri = "http://localhost:20100";

	// see if this can be set more dynamically:
	context.setContextPath("/");
	context.setResourceBase(new File("src/main/webapp/").getCanonicalPath());
	context.setDescriptor(new File("src/main/webapp/").getCanonicalPath() + "/WEB-INF/web.xml");

	server.setHandler(context);
	server.start();
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:22,代码来源:RecommenderImplTest.java

示例5: setUpBeforeClass

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
	// start the server:
	server = new Server(port);
	WebAppContext context = new WebAppContext();

	uri = "http://localhost:20100";

	// see if this can be set more dynamically:
	context.setContextPath("/");
	context.setResourceBase(new File("src/main/webapp/").getCanonicalPath());
	context.setDescriptor(new File("src/main/webapp/").getCanonicalPath() + "/WEB-INF/web.xml");

	server.setHandler(context);
	server.start();

	ContentProviderCRUD proxy1 = ProxyFactory.create(ContentProviderCRUD.class, uri);
	proxy1.createContentProvider(new ContentProvider(ConstantsTest.CP, System.currentTimeMillis() / 1000, true));

	CollectionImport proxy2 = ProxyFactory.create(CollectionImport.class, uri);
	proxy2.deleteCollection(ConstantsTest.CP, ConstantsTest.COLLECTION);
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:27,代码来源:CollectionImportImplTest.java

示例6: setUpBeforeClass

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
	// start the server:
	server = new Server(port);
	WebAppContext context = new WebAppContext();

	uri = "http://localhost:20200";

	// see if this can be set more dynamically:
	context.setContextPath("/");
	context.setResourceBase(new File("src/main/webapp/").getCanonicalPath());
	context.setDescriptor(new File("src/main/webapp/").getCanonicalPath() + "/WEB-INF/web.xml");

	server.setHandler(context);
	server.start();
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:21,代码来源:UserDataImplTest.java

示例7: setUp

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUp() throws Exception
{
	// start the server:
	server = new Server(port);
	WebAppContext context = new WebAppContext();

	uri = "http://localhost:20200";

	// see if this can be set more dynamically:
	context.setContextPath("/");
	context.setResourceBase(new File("src/main/webapp/").getCanonicalPath());
	context.setDescriptor(new File("src/main/webapp/").getCanonicalPath() + "/WEB-INF/web.xml");

	server.setHandler(context);
	server.start();
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:21,代码来源:RecommenderImplTest.java

示例8: main

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception
{
    String jetty_home=System.getProperty("jetty.home","../../..");

    String jetty_port=System.getProperty("jetty.port", "8080");

    String node_name=System.getProperty("node.name", "red");

    Server server = new Server();
    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(Integer.parseInt(jetty_port));
    server.setConnectors(new Connector[]{connector});
    
    HandlerCollection handlers = new HandlerCollection();
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    
    //TODO: find a way to dynamically get the endpoint url
    WadiCluster wadiCluster = new WadiCluster("CLUSTER", node_name, "http://localhost:"+jetty_port+"/test");
    wadiCluster.doStart();
    
    WadiSessionManager wadiManager = new WadiSessionManager(wadiCluster, 2, 24, 360);
    
    WadiSessionHandler wSessionHandler = new WadiSessionHandler(wadiManager);
    WebAppContext wah = new WebAppContext(null, wSessionHandler, null, null);
    wah.setContextPath("/test");
    wah.setResourceBase(jetty_home+"/webapps/test");
    
    contexts.setHandlers(new Handler[]{wah});
    handlers.setHandlers(new Handler[]{contexts,new DefaultHandler()});
    server.setHandler(handlers);

    HashUserRealm hur = new HashUserRealm();
    hur.setName("Test Realm");
    hur.setConfig(jetty_home+"/etc/realm.properties");
    wah.getSecurityHandler().setUserRealm(hur);
    
    server.start();
    server.join();
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:40,代码来源:WadiSessionHandler.java

示例9: doStart

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public static void doStart() throws Exception {

        Server server = new Server();
        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(JETTY_SERVER_PORT);

        String webDefault = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + "**/webdefault.xml";
        Resource web = resolver.getResources(webDefault)[0];
        String descriptor = web.getFile().getAbsolutePath();

        String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + "**/" + SpiderJetty.class.getName() + ".class";
        Resource resource = resolver.getResources(pattern)[0];
        String resourcePath = resource.getFile().getAbsolutePath().replaceAll("target.*$", "") + "webapp";

        WebAppContext context = new WebAppContext();
        context.setContextPath("/");
        context.setDefaultsDescriptor(descriptor);
        context.setResourceBase("file:" + resourcePath);
        context.setClassLoader(Thread.currentThread().getContextClassLoader());

        server.setConnectors(new Connector[]{connector});
        server.setHandler(context);

        server.setStopAtShutdown(true);
        server.setSendServerVersion(false);
        server.setSendDateHeader(false);
        server.setGracefulShutdown(1000);


        try {
            server.start();
            server.join();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
开发者ID:MartinDai,项目名称:TBSpider,代码行数:37,代码来源:SpiderJetty.java

示例10: main

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
    Server server = new Server(8080);

    WebAppContext context = new WebAppContext();
    context.setDescriptor(WEB_XML_PATH);
    context.setResourceBase(WEBAPPS_PATH);
    context.setContextPath("/");
    context.setParentLoaderPriority(true);

    server.setHandler(context);

    server.start();
    server.join();
}
 
开发者ID:anstarovoyt,项目名称:rush,代码行数:16,代码来源:App.java

示例11: main

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
int port = 8080;
if (args.length != 1) {
	printMessage();
} else {
	int argPort = port;
	try {
		argPort = Integer.parseInt(args[0]);
	} catch (NumberFormatException e) {
		printMessage();
	}
	if (argPort < 0) {
		System.err
				.println("Port number cannot be negative. Reverting to default port 8080.");
		argPort = port;
	}
	port = argPort;
}
Server server = new Server(port);
  	
  	DB db = new DB();
  	
  	db.loadDriver();
  	if (db.isIndexEmpty()) {
  		System.out.println("No indexes found. Please create an index before starting the application.");
  		db.shutdown();
  		System.exit(0);
  	}
  	db.loadCorporaInformation();
  	db.shutdown();
  	
      WebAppContext context = new WebAppContext();
      context.setDescriptor("./server/WEB-INF/web.xml");
      context.setResourceBase("./server");
      context.setContextPath("/");
      context.setParentLoaderPriority(true);

      server.setHandler(context);
      server.setThreadPool(new QueuedThreadPool(500));

      server.start();
      server.join();
  }
 
开发者ID:arne-cl,项目名称:fangorn,代码行数:44,代码来源:StartServer.java

示例12: main

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {

    if (args.length == 0) {
      System.out.println("JettyMain {port} {zookeeperQuorum}");
    }
    try {
      Configuration config = HBaseConfiguration.create();
      config.addResource("/etc/hbase/conf/hbase-site.xml");
      config.set(HConstants.ZOOKEEPER_QUORUM, args[1]);
      //config.set(HConstants.ZOOKEEPER_CLIENT_PORT, "2181");

      HBaseService hbaseService = new HBaseService(config);

      Server server = new Server(Integer.parseInt(args[0]));

      WebAppContext webapp = new WebAppContext();
      webapp.setContextPath("/fe");
      webapp.setResourceBase("./webapp");
      webapp.setWelcomeFiles(new String[]{"index.html"});

      Context servletContext = new Context();
      servletContext.setContextPath("/be");
      servletContext.addServlet(GraphTsvServlet.class, "/graph.tsv");
      servletContext.addServlet(FileGetterServlet.class, "/file/*");
      servletContext.addServlet(NodeAutoCompleteServlet.class, "/auto/*");
      servletContext.addServlet(GraphNodeJsonServlet.class, "/nodeGraph/*");
      servletContext.addServlet(NodeHomeDashBoardInfoServlet.class, "/nodeDash/*");

      server.setHandlers(new Handler[]{webapp, servletContext});

      System.out.println("-");

      GraphTsvServlet.setHBaseService(hbaseService);
      FileGetterServlet.setHBaseService(hbaseService);
      NodeAutoCompleteServlet.setHBaseService(hbaseService);
      GraphNodeJsonServlet.setHBaseService(hbaseService);
      NodeHomeDashBoardInfoServlet.setHBaseService(hbaseService);

      server.start();
      server.join();

    } finally {
      System.out.println("Step 7: Shut Down");
    }
  }
 
开发者ID:hadooparchitecturebook,项目名称:fraud-detection-tutorial,代码行数:46,代码来源:JettyMain.java

示例13: HttpServer

import org.mortbay.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public HttpServer(String name, String bindAddress, int port,
    boolean findPort, Connector connector, Configuration conf,
    String[] pathSpecs) throws IOException {
  this.webServer = new Server();
  this.findPort = findPort;

  if (connector == null) {
    listenerStartedExternally = false;
    listener = createBaseListener(conf);
    listener.setHost(bindAddress);
    listener.setPort(port);

  } else {
    listenerStartedExternally = true;
    listener = connector;
  }
  webServer.addConnector(listener);

  SessionIdManager sessionIdManager = new HashSessionIdManager(new Random(System.currentTimeMillis()));
  webServer.setSessionIdManager(sessionIdManager);

  int maxThreads = conf.getInt("tajo.http.maxthreads", -1);
  // If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
  // default value (currently 250).
  QueuedThreadPool threadPool = maxThreads == -1 ? new QueuedThreadPool()
      : new QueuedThreadPool(maxThreads);
  webServer.setThreadPool(threadPool);

  final String appDir = getWebAppsPath(name);
  ContextHandlerCollection contexts = new ContextHandlerCollection();

  webAppContext = new WebAppContext();
  webAppContext.setDisplayName(name);
  webAppContext.setContextPath("/");
  webAppContext.setResourceBase(appDir + "/" + name);
  webAppContext.setDescriptor(appDir + "/" + name + "/WEB-INF/web.xml");

  contexts.addHandler(webAppContext);
  webServer.setHandler(contexts);

  addDefaultApps(contexts, appDir, conf);
}
 
开发者ID:apache,项目名称:tajo,代码行数:43,代码来源:HttpServer.java


注:本文中的org.mortbay.jetty.webapp.WebAppContext.setResourceBase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。