本文整理汇总了Java中org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer类的典型用法代码示例。如果您正苦于以下问题:Java TomcatContextCustomizer类的具体用法?Java TomcatContextCustomizer怎么用?Java TomcatContextCustomizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TomcatContextCustomizer类属于org.springframework.boot.context.embedded.tomcat包,在下文中一共展示了TomcatContextCustomizer类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cookieProcessorCustomizer
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的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());
}
});
}
}
};
}
示例2: redirectContextRootCanBeConfigured
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的package包/类
@Test
public void redirectContextRootCanBeConfigured() throws Exception {
Map<String, String> map = new HashMap<String, String>();
map.put("server.tomcat.redirect-context-root", "false");
bindProperties(map);
ServerProperties.Tomcat tomcat = this.properties.getTomcat();
assertThat(tomcat.getRedirectContextRoot()).isEqualTo(false);
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
this.properties.customize(container);
Context context = mock(Context.class);
for (TomcatContextCustomizer customizer : container
.getTomcatContextCustomizers()) {
customizer.customize(context);
}
verify(context).setMapperContextRootRedirectEnabled(false);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:ServerPropertiesTests.java
示例3: customizer
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer customizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
TomcatContextCustomizer contextCustomizer = new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
context.setCookieProcessor(new LegacyCookieProcessor());
}
};
tomcat.addContextCustomizers(contextCustomizer);
}
};
}
示例4: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
MockService config = MockService.getInstance();
factory.setPort(config.getPort());
factory.setSessionTimeout(10, TimeUnit.MINUTES);
factory.addContextCustomizers(new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
JarScanner jarScanner = new JarScanner() {
@Override
public void scan(ServletContext arg0, ClassLoader arg1,
JarScannerCallback arg2, Set<String> arg3) {
}
};
context.setJarScanner(jarScanner);
}
});
return factory;
}
示例5: containerCustomizer
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
if (highAvailability) {
logger.info("Setting up high availability configuration");
return factory -> {
logger.info("Customizing Tomcat container");
TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;
TomcatContextCustomizer tomcatContextCustomizer = context -> {
context.setSessionTimeout(30);
context.setManager(new MemcachedBackupSessionManager() {{
setMemcachedNodes(nodes);
setFailoverNodes(failover);
setRequestUriIgnorePattern(".*\\.(ico|png|gif|jpg|css|js)$");
}});
};
containerFactory.setTomcatContextCustomizers(Collections.singletonList(tomcatContextCustomizer));
setMimeMappings(factory);
};
} else {
logger.info("Skipping HA configuration");
return this::setMimeMappings;
}
}
示例6: tomcatContextCustomizer
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的package包/类
@Bean
public TomcatContextCustomizer tomcatContextCustomizer() {
return new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
context.addServletContainerInitializer(new WsSci(), null);
}
};
}
示例7: configure
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的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));
}
});
}
示例8: customizeBackgroundProcessorDelay
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的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
示例9: customizeRedirectContextRoot
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的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
示例10: doCustomize
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的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
示例11: tomcatContextCustomizer
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的package包/类
@Bean
public TomcatContextCustomizer tomcatContextCustomizer() {
return new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
context.addApplicationListener("org.apache.tomcat.websocket.server.WsContextListener");
}
};
}
示例12: factory
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的package包/类
@Bean public TomcatEmbeddedServletContainerFactory factory() {
TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = new TomcatEmbeddedServletContainerFactory();
tomcatEmbeddedServletContainerFactory.addContextCustomizers((TomcatContextCustomizer) (Context context) -> {
context.addServletContainerInitializer(new JasperInitializer(), Collections.<Class<?>> emptySet());
});
return tomcatEmbeddedServletContainerFactory;
}
示例13: servletContainerCustomizer
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
if (container instanceof TomcatEmbeddedServletContainerFactory) {
customizeTomcat((TomcatEmbeddedServletContainerFactory)container);
}
}
private void customizeTomcat(TomcatEmbeddedServletContainerFactory tomcatFactory) {
tomcatFactory.addContextCustomizers(new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
Container jsp = context.findChild("jsp");
if (jsp instanceof Wrapper) {
((Wrapper)jsp).addInitParameter("development", "false");
}
}
});
}
};
}
示例14: tomcatContainerFactory
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer; //导入依赖的package包/类
@Bean
public TomcatEmbeddedServletContainerFactory tomcatContainerFactory() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.setTomcatContextCustomizers(
Arrays.asList(new TomcatContextCustomizer[] { tomcatContextCustomizer() }));
return factory;
}