Java 类org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer 实例源码

项目:karate    文件:TomcatConfig.java   
@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());
                    }                        
                });
            }
        }

    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ServerPropertiesTests.java   
@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);
}
项目:recaptcha-spring-boot-starter    文件:TestApplication.java   
@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);
        }
    };
}
项目:odo    文件:TestHttpProxyContainer.java   
@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;
}
项目:ozwillo-portal    文件:OasisWebConfiguration.java   
@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;
    }
}
项目:airsonic    文件:TomcatApplication.java   
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));
                }
            });
    }
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ServerProperties.java   
private void customizeBackgroundProcessorDelay(
        TomcatEmbeddedServletContainerFactory factory) {
    factory.addContextCustomizers(new TomcatContextCustomizer() {

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

    });
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ServerProperties.java   
private void customizeRedirectContextRoot(
        TomcatEmbeddedServletContainerFactory factory,
        final boolean redirectContextRoot) {
    factory.addContextCustomizers(new TomcatContextCustomizer() {

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

    });
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:TomcatWebSocketContainerCustomizer.java   
@Override
public void doCustomize(TomcatEmbeddedServletContainerFactory tomcatContainer) {
    tomcatContainer.addContextCustomizers(new TomcatContextCustomizer() {
        @Override
        public void customize(Context context) {
            addListener(context, findListenerType());
        }
    });
}
项目:mdw    文件:SpringBootApplication.java   
@Bean
public TomcatContextCustomizer tomcatContextCustomizer() {
    return new TomcatContextCustomizer() {
        @Override
        public void customize(Context context) {
            context.addApplicationListener("org.apache.tomcat.websocket.server.WsContextListener");
        }
    };
}
项目:spring-boot-concourse    文件:ServerProperties.java   
private void customizeBackgroundProcessorDelay(
        TomcatEmbeddedServletContainerFactory factory) {
    factory.addContextCustomizers(new TomcatContextCustomizer() {

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

    });
}
项目:spring-boot-concourse    文件:TomcatWebSocketContainerCustomizer.java   
@Override
public void doCustomize(TomcatEmbeddedServletContainerFactory tomcatContainer) {
    tomcatContainer.addContextCustomizers(new TomcatContextCustomizer() {
        @Override
        public void customize(Context context) {
            addListener(context, findListenerType());
        }
    });
}
项目:contestparser    文件:ServerProperties.java   
private void customizeBackgroundProcessorDelay(
        TomcatEmbeddedServletContainerFactory factory) {
    factory.addContextCustomizers(new TomcatContextCustomizer() {

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

    });
}
项目:contestparser    文件:TomcatWebSocketContainerCustomizer.java   
@Override
public void doCustomize(TomcatEmbeddedServletContainerFactory tomcatContainer) {
    tomcatContainer.addContextCustomizers(new TomcatContextCustomizer() {
        @Override
        public void customize(Context context) {
            addListener(context, findListenerType());
        }
    });
}
项目:web-harvester    文件:ControllerConfiguration.java   
@Bean public TomcatEmbeddedServletContainerFactory factory() {
    TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = new TomcatEmbeddedServletContainerFactory();
    tomcatEmbeddedServletContainerFactory.addContextCustomizers((TomcatContextCustomizer) (Context context) -> {
        context.addServletContainerInitializer(new JasperInitializer(), Collections.<Class<?>> emptySet());
    });
    return tomcatEmbeddedServletContainerFactory;

}
项目:lightadmin-springboot    文件:LightAdminBootApplication.java   
@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");
                    }

                }

            });
        }

    };
}
项目:kurento-java    文件:JsonRpcConfiguration.java   
@Bean
public TomcatEmbeddedServletContainerFactory tomcatContainerFactory() {
  TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
  factory.setTomcatContextCustomizers(
      Arrays.asList(new TomcatContextCustomizer[] { tomcatContextCustomizer() }));
  return factory;
}
项目:kurento-java    文件:JsonRpcConfiguration.java   
@Bean
public TomcatContextCustomizer tomcatContextCustomizer() {
  return new TomcatContextCustomizer() {
    @Override
    public void customize(Context context) {
      context.addServletContainerInitializer(new WsSci(), null);
    }
  };
}
项目:springboot-angular-atmosphere-quickstart    文件:WebConfigurer.java   
@Bean
public TomcatContextCustomizer tomcatContextCustomizer() {
  return new TomcatContextCustomizer() {
    @Override
    public void customize(Context context) {
      context.addServletContainerInitializer(new WsSci(), null);
    }
  };
}