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


Java WebAppContext.setParentLoaderPriority方法代码示例

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


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

示例1: start

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public void start() throws Exception
{
    String relativelyPath = System.getProperty("user.dir");

    server = new Server(port);
    WebAppContext webAppContext = new WebAppContext();
    webAppContext.setContextPath("/");
    webAppContext.setWar(relativelyPath + "\\rainbow-web\\target\\rainbow-web.war");
    webAppContext.setParentLoaderPriority(true);
    webAppContext.setServer(server);
    webAppContext.setClassLoader(ClassLoader.getSystemClassLoader());
    webAppContext.getSessionHandler().getSessionManager()
            .setMaxInactiveInterval(10);
    server.setHandler(webAppContext);
    server.start();
}
 
开发者ID:dbiir,项目名称:rainbow,代码行数:17,代码来源:RwServer.java

示例2: addWebApplication

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public static Server addWebApplication(final Server jetty, final String webAppContext,
    final String warFilePath) {
  WebAppContext webapp = new WebAppContext();
  webapp.setContextPath(webAppContext);
  webapp.setWar(warFilePath);
  webapp.setParentLoaderPriority(false);
  webapp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");

  File tmpPath = new File(getWebAppBaseDirectory(webAppContext));
  tmpPath.mkdirs();
  webapp.setTempDirectory(tmpPath);

  ((HandlerCollection) jetty.getHandler()).addHandler(webapp);

  return jetty;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:17,代码来源:JettyHelper.java

示例3: setupWebAppContext

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
private static WebAppContext setupWebAppContext(
    ZeppelinConfiguration conf) {

  WebAppContext webApp = new WebAppContext();
  webApp.setContextPath(conf.getServerContextPath());
  File warPath = new File(conf.getString(ConfVars.ZEPPELIN_WAR));
  if (warPath.isDirectory()) {
    // Development mode, read from FS
    // webApp.setDescriptor(warPath+"/WEB-INF/web.xml");
    webApp.setResourceBase(warPath.getPath());
    webApp.setParentLoaderPriority(true);
  } else {
    // use packaged WAR
    webApp.setWar(warPath.getAbsolutePath());
    File warTempDirectory = new File(conf.getRelativeDir(ConfVars.ZEPPELIN_WAR_TEMPDIR));
    warTempDirectory.mkdir();
    LOG.info("ZeppelinServer Webapp path: {}", warTempDirectory.getPath());
    webApp.setTempDirectory(warTempDirectory);
  }
  // Explicit bind to root
  webApp.addServlet(new ServletHolder(new DefaultServlet()), "/*");
  return webApp;
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:24,代码来源:ZeppelinServer.java

示例4: createDevServer

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public static Server createDevServer() {
	PlatformServerConfig.DEV_MODE = true;
	Path projectPath = Paths.get(System.getProperty("user.dir")).toAbsolutePath();
	Server jettyServer = new Server(8080);  
    WebAppContext context = new WebAppContext();  
    context.setContextPath("/BIMplatform");
    context.setDescriptor(projectPath.resolve("WebContent/WEB-INF/web.xml").toAbsolutePath().toString()); // 指定web.xml配置文件 
    context.setResourceBase(projectPath.resolve("WebContent/").toAbsolutePath().toString());// 指定webapp目录  
    context.setParentLoaderPriority(true); 
    jettyServer.setHandler(context);  

    return jettyServer;
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:14,代码来源:PlatformServerStarter.java

示例5: start

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public void start() throws Exception
{
    server = new Server(port);

    WebAppContext webAppContext = new WebAppContext();
    webAppContext.setContextPath("/");
    webAppContext.setWar("/Users/Jelly/Developer/paraflow/paraflow-http-server/target/paraflow-server.war");
    webAppContext.setParentLoaderPriority(true);
    webAppContext.setServer(server);
    webAppContext.setClassLoader(ClassLoader.getSystemClassLoader());
    webAppContext.getSessionHandler().getSessionManager()
            .setMaxInactiveInterval(10);
    server.setHandler(webAppContext);
    server.start();
}
 
开发者ID:dbiir,项目名称:paraflow,代码行数:16,代码来源:DataServer.java

示例6: beforeClass

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	/*
	 * This runs under maven, and I'm not sure how else to figure out the target directory from code..
	 */
	String path = ExampleServerIT.class.getClassLoader().getResource(".keep_hapi-fhir-jpaserver-example").getPath();
	path = new File(path).getParent();
	path = new File(path).getParent();
	path = new File(path).getParent();

	ourLog.info("Project base path is: {}", path);

	ourPort = RandomServerPortProvider.findFreePort();
	ourServer = new Server(ourPort);

	WebAppContext webAppContext = new WebAppContext();
	webAppContext.setContextPath("/");
	webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml");
	webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-example");
	webAppContext.setParentLoaderPriority(true);

	ourServer.setHandler(webAppContext);
	ourServer.start();

	ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
	ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000);
	ourServerBase = "http://localhost:" + ourPort + "/baseDstu2";
	ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
	ourClient.registerInterceptor(new LoggingInterceptor(true));

}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:32,代码来源:ExampleServerIT.java

示例7: main

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

    int port = 8888;
    if (args.length > 0) {
        port = Integer.parseInt(args[0]);
    }
    if (port == 80) {
        System.out.println("Dorset web demo running on http://localhost/");            
    } else {
        System.out.println("Dorset web demo running on http://localhost:" 
                        + String.valueOf(port) + "/");
    }
    Server server = new Server(port);

    WebAppContext context = new WebAppContext();
    context.setServer(server);
    context.setContextPath("/");
    // turn off class loading from WEB-INF due to logging
    context.setParentLoaderPriority(true);

    ProtectionDomain protectionDomain = Runner.class.getProtectionDomain();
    URL location = protectionDomain.getCodeSource().getLocation();
    context.setWar(location.toExternalForm());

    server.setHandler(context);
    server.start();
    server.join();
}
 
开发者ID:NEStock,项目名称:Voice_Activated_EV3_Robot,代码行数:31,代码来源:Runner.java

示例8: startServer

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
protected static void startServer(int port, String rootPath, String dbCfgPath)
		throws Exception, InterruptedException {
	Server server = new Server(port);
	WebAppContext webAppContext = new WebAppContext();
	webAppContext.setContextPath(rootPath);
	if (dbCfgPath != null) {
		Configurator cfg = null;
		try {
			cfg = ConfiguratorFactory.getInstance(APPINFO.getDbCfgFile());
		} catch (Exception e) {
			cfg = ConfiguratorFactory.getDefaultInstance();
		}
		if(cfg!=null) {ProcessLogger.debug(cfg.toString());}
		else {
			ProcessLogger.warn("Could not find db config file.");
		}
	}
	/* Important: Use getResource */
	String webxmlLocation = AppStarter.class.getResource("/webapp/WEB-INF/web.xml").toString();
	webAppContext.setDescriptor(webxmlLocation);

	/* Important: Use getResource */
	String resLocation = AppStarter.class.getResource("/webapp").toString();
	webAppContext.setResourceBase(resLocation);

	webAppContext.setParentLoaderPriority(true);

	server.setHandler(webAppContext);
	server.start();
	server.join();
}
 
开发者ID:daileyet,项目名称:helpdesk,代码行数:32,代码来源:AppStarter.java

示例9: beforeClass

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	// 创建一个server
	server = new Server(8080);
	WebAppContext context = new WebAppContext();
	String webapp = "F:/github/asm/WebContent";
	context.setDescriptor(webapp + "/WEB-INF/web.xml"); // 指定web.xml配置文件
	context.setResourceBase(webapp); // 指定webapp目录
	context.setContextPath("/");
	context.setParentLoaderPriority(true);

	server.setHandler(context);
	server.start();
}
 
开发者ID:booleguo,项目名称:sam-elle,代码行数:15,代码来源:FetchSoldBtysTest.java

示例10: beforeClass

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	// 创建一个server
	server = new Server(8080);
	WebAppContext context = new WebAppContext();
	String webapp = "D:\\sam-elle\\WebContent";
	context.setDescriptor(webapp + "/WEB-INF/web.xml"); // 指定web.xml配置文件
	context.setResourceBase(webapp); // 指定webapp目录
	context.setContextPath("/");
	context.setParentLoaderPriority(true);

	server.setHandler(context);
	server.start();
}
 
开发者ID:booleguo,项目名称:sam-elle,代码行数:15,代码来源:SignupTest.java

示例11: main

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

	WebAppContext webAppContext = new WebAppContext();
	webAppContext.setContextPath("/");
	webAppContext.setConfigurations(new Configuration[] {
			new WebApplicationInitializersConfiguration(SpringInitializer.class) });

	webAppContext.setParentLoaderPriority(true);
	server.setHandler(webAppContext);
	server.start();

	server.join();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:EmbeddedWarStarter.java

示例12: executionControllerStart

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
@Override
public void executionControllerStart(GlobalContext context) throws Exception {
	context.getServiceRegistrationCallback().registerService(RtmPluginServices.class);

	Properties rtmProperties = Configuration.getInstance().getUnderlyingPropertyObject();
	step.commons.conf.Configuration stepProperties = step.commons.conf.Configuration.getInstance(); 

	if(stepProperties.getPropertyAsBoolean("plugins.rtm.useLocalDB", true) == true){
	cloneProperty(rtmProperties, stepProperties, "db.host");
	cloneProperty(rtmProperties, stepProperties, "db.port");
	cloneProperty(rtmProperties, stepProperties, "db.database");
	cloneProperty(rtmProperties, stepProperties, "db.username");
	cloneProperty(rtmProperties, stepProperties, "db.password");
	}
	measureReportNodes = stepProperties.getPropertyAsBoolean("plugins.rtm.measurereportnodes", true);
	
	AbstractAccessor.createOrUpdateCompoundIndex(context.getMongoDatabase().getCollection("measurements"),"eId", "begin");

	WebAppContext webappCtx = new WebAppContext();
	webappCtx.setContextPath("/rtm");

	String war = step.commons.conf.Configuration.getInstance().getProperty("plugins.rtm.war");
	if(war==null) {
		throw new RuntimeException("Property 'plugins.rtm.war' is null. Unable to start RTM.");
	} else {
		File warFile = new File(war);
		if(!warFile.exists()||!warFile.canRead()) {
			throw new RuntimeException("The file '"+war+"' set by the property 'plugins.rtm.war' doesn't exist or cannot be read. Unable to start RTM.");	
		}
	}
	webappCtx.setWar(war);
	webappCtx.setParentLoaderPriority(true);
	context.getServiceRegistrationCallback().registerHandler(webappCtx);

	accessor = MeasurementAccessor.getInstance();
}
 
开发者ID:denkbar,项目名称:step,代码行数:37,代码来源:RtmPlugin.java

示例13: configure

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
@Override
public Server configure() throws Exception {
    Server server = new Server(port);

    WebAppContext context = new WebAppContext();
    context.setResourceBase("../jetty-core/src/test/resources/" + appName);
    context.setLogUrlOnStart(true);
    context.setContextPath("/");
    context.setParentLoaderPriority(true);

    HazelcastSessionIdManager idManager = new HazelcastSessionIdManager(server, clientOnly);

    idManager.setWorkerName("worker-" + port);
    server.setSessionIdManager(idManager);

    HazelcastSessionManager sessionManager = new HazelcastSessionManager();
    sessionManager.setSessionIdManager(idManager);

    SessionHandler handler = new SessionHandler(sessionManager);
    context.setSessionHandler(handler);

    server.setHandler(context);
    server.setGracefulShutdown(0);

    HashLoginService loginService = new HashLoginService();
    loginService.putUser("someuser", Credential.getCredential("somepass"), new String[]{"role1", "role2"});
    context.getSecurityHandler().setLoginService(loginService);

    return server;
}
 
开发者ID:hazelcast,项目名称:hazelcast-jetty-sessionmanager,代码行数:31,代码来源:JettyConfigurator.java

示例14: start

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
public void start(boolean devMode, int port) throws Exception {

        Server server = new Server(new QueuedThreadPool(500));

        WebAppContext appContext = new WebAppContext();

        String resourceBasePath = "";
        //开发者模式
        if (devMode) {
            String artifact = MavenUtils.get(Thread.currentThread().getContextClassLoader()).getArtifactId();
            resourceBasePath = artifact + "/src/main/webapp";
        }
        appContext.setDescriptor(resourceBasePath + "WEB-INF/web.xml");
        appContext.setResourceBase(resourceBasePath);
        appContext.setExtractWAR(true);

        //init param
        appContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
        if (CommonUtils.isWindowOs()) {
            appContext.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
        }

        //for jsp support
        appContext.addBean(new JettyJspParser(appContext));
        appContext.addServlet(JettyJspServlet.class, "*.jsp");

        appContext.setContextPath("/");
        appContext.getServletContext().setExtendedListenerTypes(true);
        appContext.setParentLoaderPriority(true);
        appContext.setThrowUnavailableOnStartupException(true);
        appContext.setConfigurationDiscovered(true);
        appContext.setClassLoader(Thread.currentThread().getContextClassLoader());

        ServerConnector connector = new ServerConnector(server);
        connector.setHost("0.0.0.0");
        connector.setPort(port);
        server.setConnectors(new Connector[]{connector});
        server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", 1024 * 1024 * 1024);
        server.setDumpAfterStart(false);
        server.setDumpBeforeStop(false);
        server.setStopAtShutdown(true);
        server.setHandler(appContext);
        logger.info("[opencron] JettyLauncher starting...");
        server.start();
    }
 
开发者ID:wolfboys,项目名称:opencron,代码行数:46,代码来源:JettyLauncher.java

示例15: startJettyServer

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

		final Server server = new Server(Configs.getInt("jetty.port"));
		
		WebAppContext context = new WebAppContext();
		String classesPath = RexxarReaderWebBoot.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm();
		String webContextPath = StringUtils.substringBefore(classesPath, "/WEB-INF");
		logger.info("classesPath : {}",classesPath);
		logger.info("web context : {}",webContextPath);
		
		context.setResourceBase(webContextPath);
		context.setContextPath("/");
		context.setParentLoaderPriority(true);
		context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
		context.setClassLoader(Thread.currentThread().getContextClassLoader());
	    context.setConfigurationClasses(Lists.newArrayList("org.eclipse.jetty.webapp.WebInfConfiguration",
	            "org.eclipse.jetty.webapp.WebXmlConfiguration",
	            "org.eclipse.jetty.webapp.MetaInfConfiguration",
	            "org.eclipse.jetty.webapp.FragmentConfiguration",
	            "org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
	            "org.eclipse.jetty.annotations.AnnotationConfiguration"));
	   
	    server.setHandler(context);

	    server.start();		
	    
	    logger.info("reader server start");
	    
	    Runtime.getRuntime().addShutdownHook(new Thread() {
	        @Override
	        public void run() {
	          try {
	            server.stop();
	            logger.info("reader server stop");
	          } catch (Exception e) {
	            logger.error(e.getMessage(),e);
	            e.printStackTrace();
	          }
	        }
	      });
	      
	    server.join();
	    
	}
 
开发者ID:phoenix2014,项目名称:rexxar,代码行数:45,代码来源:RexxarReaderWebBoot.java


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