org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer Java Examples

The following examples show how to use org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TomcatConfiguration.java    From spring-boot-inside with MIT License 6 votes vote down vote up
@Bean
public EmbeddedServletContainerCustomizer staticResourceCustomizer() {
	return new EmbeddedServletContainerCustomizer() {
		@Override
		public void customize(ConfigurableEmbeddedServletContainer container) {
			if (container instanceof TomcatEmbeddedServletContainerFactory) {
				((TomcatEmbeddedServletContainerFactory) container)
						.addContextCustomizers(new TomcatContextCustomizer() {
							@Override
							public void customize(Context context) {
								context.addLifecycleListener(new StaticResourceConfigurer(context));
							}
						});
			}
		}

	};
}
 
Example #2
Source File: TomcatConfig.java    From karate with MIT License 6 votes vote down vote up
@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());
                    }                        
                });
            }
        }

    };
}
 
Example #3
Source File: TomcatConfiguration.java    From spring-boot-fat-jar-jsp-sample with MIT License 6 votes vote down vote up
@Bean
public EmbeddedServletContainerCustomizer staticResourceCustomizer() {
	return new EmbeddedServletContainerCustomizer() {
		@Override
		public void customize(ConfigurableEmbeddedServletContainer container) {
			if (container instanceof TomcatEmbeddedServletContainerFactory) {
				((TomcatEmbeddedServletContainerFactory) container)
						.addContextCustomizers(new TomcatContextCustomizer() {
							@Override
							public void customize(Context context) {
								context.addLifecycleListener(new StaticResourceConfigurer(context));
							}
						});
			}
		}

	};
}
 
Example #4
Source File: LightAdminBootApplication.java    From lightadmin-springboot with Apache License 2.0 5 votes vote down vote up
@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");
                    }

                }

            });
        }

    };
}
 
Example #5
Source File: WebConfigurer.java    From springboot-angular-atmosphere-quickstart with Apache License 2.0 5 votes vote down vote up
@Bean
public TomcatContextCustomizer tomcatContextCustomizer() {
  return new TomcatContextCustomizer() {
    @Override
    public void customize(Context context) {
      context.addServletContainerInitializer(new WsSci(), null);
    }
  };
}
 
Example #6
Source File: KeycloakAutoConfiguration.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnClass(name = {"org.apache.catalina.startup.Tomcat"})
public TomcatContextCustomizer tomcatKeycloakContextCustomizer() {
    return new KeycloakTomcatContextCustomizer(keycloakProperties);
}