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


Java TomcatEmbeddedServletContainerFactory.addContextCustomizers方法代码示例

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


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

示例1: cookieProcessorCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer cookieProcessorCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory factory = (TomcatEmbeddedServletContainerFactory) container;
                factory.addContextCustomizers(new TomcatContextCustomizer() {
                    @Override
                    public void customize(Context context) {
                        context.setCookieProcessor(new LegacyCookieProcessor());
                    }                        
                });
            }
        }

    };
}
 
开发者ID:intuit,项目名称:karate,代码行数:19,代码来源:TomcatConfig.java

示例2: embeddedServletContainerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = (TomcatEmbeddedServletContainerFactory) container;
                
                
                RedisSessionHandlerValve valve = new RedisSessionHandlerValve();
                List<RedisSessionHandlerValve> valves = 
                		new ArrayList<RedisSessionHandlerValve>();
                valves.add(0, valve);
                tomcatEmbeddedServletContainerFactory.setContextValves(valves);
                tomcatEmbeddedServletContainerFactory.setPort(28080);    // Set the port of embeded tomcat as 28080 for default. 
 
                System.out.println("Enterring EmbeddedServletContainerCustomizer.customize()...");
                tomcatEmbeddedServletContainerFactory.addContextCustomizers(
                		new ServletContainerCustomizer());
            }
        }
    };
}
 
开发者ID:xiaowing,项目名称:various_demos,代码行数:24,代码来源:Application.java

示例3: embeddedServletContainerFactory

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
/**
 * TODO: support Jetty as well
 */
@Bean
public EmbeddedServletContainerFactory embeddedServletContainerFactory(ApplicationContext ctx) {
    String portProp = System.getProperty("mdw.server.port");
    if (portProp == null)
        portProp = System.getProperty("server.port");
    if (portProp == null)
        portProp = "8080";
    String contextProp = System.getProperty("mdw.server.contextPath");
    if (contextProp == null)
        contextProp = System.getProperty("server.contextPath");
    if (contextProp == null)
        contextProp = "/mdw";
    TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory(
            contextProp, Integer.parseInt(portProp));
    factory.addContextCustomizers(tomcatContextCustomizer());
    factory.setDocumentRoot(new File(getBootDir() + "/web"));
    return factory;
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:22,代码来源:SpringBootApplication.java

示例4: configure

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
public static void configure(TomcatEmbeddedServletContainerFactory tomcatFactory) {

            tomcatFactory.addContextCustomizers((TomcatContextCustomizer) context -> {

                boolean development = (System.getProperty("airsonic.development") != null);

                // Increase the size and time before eviction of the Tomcat
                // cache so that resources aren't uncompressed too often.
                // See https://github.com/jhipster/generator-jhipster/issues/3995

                StandardRoot resources = new StandardRoot();
                if (development) {
                    resources.setCachingAllowed(false);
                } else {
                    resources.setCacheMaxSize(100000);
                    resources.setCacheObjectMaxSize(4000);
                    resources.setCacheTtl(24 * 3600 * 1000);  // 1 day, in milliseconds
                }
                context.setResources(resources);

                // Put Jasper in production mode so that JSP aren't recompiled
                // on each request.
                // See http://stackoverflow.com/questions/29653326/spring-boot-application-slow-because-of-jsp-compilation
                Container jsp = context.findChild("jsp");
                if (jsp instanceof Wrapper) {
                    ((Wrapper) jsp).addInitParameter("development", Boolean.toString(development));
                }
            });
    }
 
开发者ID:airsonic,项目名称:airsonic,代码行数:30,代码来源:TomcatApplication.java

示例5: customizeBackgroundProcessorDelay

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
private void customizeBackgroundProcessorDelay(
		TomcatEmbeddedServletContainerFactory factory) {
	factory.addContextCustomizers(new TomcatContextCustomizer() {

		@Override
		public void customize(Context context) {
			context.setBackgroundProcessorDelay(
					Tomcat.this.backgroundProcessorDelay);
		}

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

示例6: customizeRedirectContextRoot

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
private void customizeRedirectContextRoot(
		TomcatEmbeddedServletContainerFactory factory,
		final boolean redirectContextRoot) {
	factory.addContextCustomizers(new TomcatContextCustomizer() {

		@Override
		public void customize(Context context) {
			context.setMapperContextRootRedirectEnabled(redirectContextRoot);
		}

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

示例7: doCustomize

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Override
public void doCustomize(TomcatEmbeddedServletContainerFactory tomcatContainer) {
	tomcatContainer.addContextCustomizers(new TomcatContextCustomizer() {
		@Override
		public void customize(Context context) {
			addListener(context, findListenerType());
		}
	});
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:TomcatWebSocketContainerCustomizer.java

示例8: configure

import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Override
public void configure(TomcatEmbeddedServletContainerFactory tomcat, int cacheSize,
        int tomcatCacheSize) {
    tomcat.addContextCustomizers((context) -> {
        StandardRoot standardRoot = new StandardRoot(context);
        standardRoot.setCachingAllowed(true);
        standardRoot.setCacheMaxSize(cacheSize);
        standardRoot.setCacheTtl(tomcatCacheSize);
        context.setResources(standardRoot);
    });
}
 
开发者ID:epam,项目名称:NGB,代码行数:12,代码来源:TomcatConfigurerImpl.java


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