當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。