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


Java TomcatEmbeddedServletContainerFactory.addContextValves方法代碼示例

本文整理匯總了Java中org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.addContextValves方法的典型用法代碼示例。如果您正苦於以下問題:Java TomcatEmbeddedServletContainerFactory.addContextValves方法的具體用法?Java TomcatEmbeddedServletContainerFactory.addContextValves怎麽用?Java TomcatEmbeddedServletContainerFactory.addContextValves使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory的用法示例。


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

示例1: configureRewriteValve

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
private void configureRewriteValve(final TomcatEmbeddedServletContainerFactory tomcat) {
    final Resource res = casProperties.getServer().getRewriteValveConfigLocation();
    if (ResourceUtils.doesResourceExist(res)) {
        final RewriteValve valve = new RewriteValve() {
            @Override
            protected synchronized void startInternal() throws LifecycleException {
                super.startInternal();
                try (InputStream is = res.getInputStream();
                     InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);
                     BufferedReader buffer = new BufferedReader(isr)) {
                    parse(buffer);
                } catch (final Exception e) {
                    throw Throwables.propagate(e);
                }
            }
        };
        valve.setAsyncSupported(true);
        valve.setEnabled(true);

        LOGGER.debug("Creating Rewrite valve configuration for the embedded tomcat container...");
        tomcat.addContextValves(valve);
    }
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:24,代碼來源:CasEmbeddedContainerTomcatConfiguration.java

示例2: configureExtendedAccessLogValve

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
private void configureExtendedAccessLogValve(final TomcatEmbeddedServletContainerFactory tomcat) {
    final CasServerProperties.ExtendedAccessLog ext = casProperties.getServer().getExtAccessLog();

    if (ext.isEnabled() && StringUtils.isNotBlank(ext.getPattern())) {
        LOGGER.debug("Creating extended access log valve configuration for the embedded tomcat container...");
        final ExtendedAccessLogValve valve = new ExtendedAccessLogValve();
        valve.setPattern(ext.getPattern());

        if (StringUtils.isBlank(ext.getDirectory())) {
            valve.setDirectory(serverProperties.getTomcat().getAccesslog().getDirectory());
        } else {
            valve.setDirectory(ext.getDirectory());
        }
        valve.setPrefix(ext.getPrefix());
        valve.setSuffix(ext.getSuffix());
        valve.setAsyncSupported(true);
        valve.setEnabled(true);
        valve.setRotatable(true);
        valve.setBuffered(true);
        tomcat.addContextValves(valve);
        tomcat.addEngineValves(valve);
    }
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:24,代碼來源:CasEmbeddedContainerTomcatConfiguration.java

示例3: customizeRemoteIpValve

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
private void customizeRemoteIpValve(ServerProperties properties,
		TomcatEmbeddedServletContainerFactory factory) {
	String protocolHeader = getProtocolHeader();
	String remoteIpHeader = getRemoteIpHeader();
	// For back compatibility the valve is also enabled if protocol-header is set
	if (StringUtils.hasText(protocolHeader) || StringUtils.hasText(remoteIpHeader)
			|| properties.getOrDeduceUseForwardHeaders()) {
		RemoteIpValve valve = new RemoteIpValve();
		valve.setProtocolHeader(StringUtils.hasLength(protocolHeader)
				? protocolHeader : "X-Forwarded-Proto");
		if (StringUtils.hasLength(remoteIpHeader)) {
			valve.setRemoteIpHeader(remoteIpHeader);
		}
		// The internal proxies default to a white list of "safe" internal IP
		// addresses
		valve.setInternalProxies(getInternalProxies());
		valve.setPortHeader(getPortHeader());
		valve.setProtocolHeaderHttpsValue(getProtocolHeaderHttpsValue());
		// ... so it's safe to add this valve by default.
		factory.addContextValves(valve);
	}
}
 
開發者ID:philwebb,項目名稱:spring-boot-concourse,代碼行數:23,代碼來源:ServerProperties.java

示例4: customize

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    if (container instanceof TomcatEmbeddedServletContainerFactory) {
        TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) container;

        //訪問日誌設置
        LogbackValve logbackValve = new LogbackValve();
        logbackValve.setQuiet(true);
        logbackValve.setFilename(logbackAccessFile);
        containerFactory.addContextValves(logbackValve);
    }
}
 
開發者ID:ruyangit,項目名稱:angit,代碼行數:13,代碼來源:ContainerAccessLogCustomizer.java

示例5: customizeAccessLog

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
private void customizeAccessLog(TomcatEmbeddedServletContainerFactory factory) {
	AccessLogValve valve = new AccessLogValve();
	valve.setPattern(this.accesslog.getPattern());
	valve.setDirectory(this.accesslog.getDirectory());
	valve.setPrefix(this.accesslog.getPrefix());
	valve.setSuffix(this.accesslog.getSuffix());
	factory.addContextValves(valve);
}
 
開發者ID:philwebb,項目名稱:spring-boot-concourse,代碼行數:9,代碼來源:ServerProperties.java


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