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


Java WebAppContext.setDisplayName方法代码示例

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


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

示例1: configureWebAppContext

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
/**
 * Configure the given Jetty {@link WebAppContext} for use.
 * @param context the context to configure
 * @param initializers the set of initializers to apply
 */
protected final void configureWebAppContext(WebAppContext context,
		ServletContextInitializer... initializers) {
	Assert.notNull(context, "Context must not be null");
	context.setTempDirectory(getTempDirectory());
	if (this.resourceLoader != null) {
		context.setClassLoader(this.resourceLoader.getClassLoader());
	}
	String contextPath = getContextPath();
	context.setContextPath(StringUtils.hasLength(contextPath) ? contextPath : "/");
	context.setDisplayName(getDisplayName());
	configureDocumentRoot(context);
	if (isRegisterDefaultServlet()) {
		addDefaultServlet(context);
	}
	if (shouldRegisterJspServlet()) {
		addJspServlet(context);
		context.addBean(new JasperInitializer(context), true);
	}
	ServletContextInitializer[] initializersToUse = mergeInitializers(initializers);
	Configuration[] configurations = getWebAppContextConfigurations(context,
			initializersToUse);
	context.setConfigurations(configurations);
	configureSession(context);
	postProcessWebAppContext(context);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:31,代码来源:JettyEmbeddedServletContainerFactory.java

示例2: configureWebAppContext

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
/**
 * Configure the given Jetty {@link WebAppContext} for use.
 * @param context the context to configure
 * @param initializers the set of initializers to apply
 */
protected final void configureWebAppContext(WebAppContext context,
		ServletContextInitializer... initializers) {
	Assert.notNull(context, "Context must not be null");
	context.setTempDirectory(getTempDirectory());
	if (this.resourceLoader != null) {
		context.setClassLoader(this.resourceLoader.getClassLoader());
	}
	String contextPath = getContextPath();
	context.setContextPath(StringUtils.hasLength(contextPath) ? contextPath : "/");
	context.setDisplayName(getDisplayName());
	configureDocumentRoot(context);
	if (isRegisterDefaultServlet()) {
		addDefaultServlet(context);
	}
	if (shouldRegisterJspServlet()) {
		addJspServlet(context);
	}
	ServletContextInitializer[] initializersToUse = mergeInitializers(initializers);
	Configuration[] configurations = getWebAppContextConfigurations(context,
			initializersToUse);
	context.setConfigurations(configurations);
	configureSession(context);
	postProcessWebAppContext(context);
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:30,代码来源:JettyEmbeddedServletContainerFactory.java

示例3: loadWar

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
private WebAppContext loadWar(final File warFile, final String contextPath) throws IOException {
    final WebAppContext webappContext = new WebAppContext(warFile.getPath(), contextPath);
    webappContext.setContextPath(contextPath);
    webappContext.setDisplayName(contextPath);

    // remove slf4j server class to allow WAR files to have slf4j dependencies in WEB-INF/lib
    List<String> serverClasses = new ArrayList<>(Arrays.asList(webappContext.getServerClasses()));
    serverClasses.remove("org.slf4j.");
    webappContext.setServerClasses(serverClasses.toArray(new String[0]));
    webappContext.setDefaultsDescriptor(WEB_DEFAULTS_XML);

    // get the temp directory for this webapp
    final File webWorkingDirectory = properties.getWebWorkingDirectory();
    final File tempDir = new File(webWorkingDirectory, warFile.getName());
    if (tempDir.exists() && !tempDir.isDirectory()) {
        throw new RuntimeException(tempDir.getAbsolutePath() + " is not a directory");
    } else if (!tempDir.exists()) {
        final boolean made = tempDir.mkdirs();
        if (!made) {
            throw new RuntimeException(tempDir.getAbsolutePath() + " could not be created");
        }
    }
    if (!(tempDir.canRead() && tempDir.canWrite())) {
        throw new RuntimeException(tempDir.getAbsolutePath() + " directory does not have read/write privilege");
    }

    // configure the temp dir
    webappContext.setTempDirectory(tempDir);

    // configure the max form size (3x the default)
    webappContext.setMaxFormContentSize(600000);

    webappContext.setClassLoader(new WebAppClassLoader(ClassLoader.getSystemClassLoader(), webappContext));

    logger.info("Loading WAR: " + warFile.getAbsolutePath() + " with context path set to " + contextPath);
    return webappContext;
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:38,代码来源:JettyServer.java

示例4: loadWar

import org.eclipse.jetty.webapp.WebAppContext; //导入方法依赖的package包/类
private static WebAppContext loadWar(final File warFile, final String contextPath, final ClassLoader parentClassLoader) throws IOException {
    final WebAppContext webappContext = new WebAppContext(warFile.getPath(), contextPath);
    webappContext.setContextPath(contextPath);
    webappContext.setDisplayName(contextPath);

    // instruction jetty to examine these jars for tlds, web-fragments, etc
    webappContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\\\.jar$|.*/[^/]*taglibs.*\\.jar$" );

    // remove slf4j server class to allow WAR files to have slf4j dependencies in WEB-INF/lib
    List<String> serverClasses = new ArrayList<>(Arrays.asList(webappContext.getServerClasses()));
    serverClasses.remove("org.slf4j.");
    webappContext.setServerClasses(serverClasses.toArray(new String[0]));
    webappContext.setDefaultsDescriptor(WEB_DEFAULTS_XML);

    // get the temp directory for this webapp
    File tempDir = Paths.get(C2_SERVER_HOME, "tmp", warFile.getName()).toFile();
    if (tempDir.exists() && !tempDir.isDirectory()) {
        throw new RuntimeException(tempDir.getAbsolutePath() + " is not a directory");
    } else if (!tempDir.exists()) {
        final boolean made = tempDir.mkdirs();
        if (!made) {
            throw new RuntimeException(tempDir.getAbsolutePath() + " could not be created");
        }
    }
    if (!(tempDir.canRead() && tempDir.canWrite())) {
        throw new RuntimeException(tempDir.getAbsolutePath() + " directory does not have read/write privilege");
    }

    // configure the temp dir
    webappContext.setTempDirectory(tempDir);

    // configure the max form size (3x the default)
    webappContext.setMaxFormContentSize(600000);

    webappContext.setClassLoader(new WebAppClassLoader(parentClassLoader, webappContext));

    logger.info("Loading WAR: " + warFile.getAbsolutePath() + " with context path set to " + contextPath);
    return webappContext;
}
 
开发者ID:apache,项目名称:nifi-minifi,代码行数:40,代码来源:JettyServer.java


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