use of org.springframework.boot.web.server.WebServerFactoryCustomizer in project keycloak by keycloak.
the class KeycloakAutoConfiguration method getKeycloakContainerCustomizer.
@Bean
public WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> getKeycloakContainerCustomizer() {
return new WebServerFactoryCustomizer<ConfigurableServletWebServerFactory>() {
@Override
public void customize(ConfigurableServletWebServerFactory configurableServletWebServerFactory) {
if (configurableServletWebServerFactory instanceof TomcatServletWebServerFactory) {
TomcatServletWebServerFactory container = (TomcatServletWebServerFactory) configurableServletWebServerFactory;
container.addContextValves(new KeycloakAuthenticatorValve());
container.addContextCustomizers(tomcatKeycloakContextCustomizer());
} else if (configurableServletWebServerFactory instanceof UndertowServletWebServerFactory) {
UndertowServletWebServerFactory container = (UndertowServletWebServerFactory) configurableServletWebServerFactory;
container.addDeploymentInfoCustomizers(undertowKeycloakContextCustomizer());
} else if (configurableServletWebServerFactory instanceof JettyServletWebServerFactory) {
JettyServletWebServerFactory container = (JettyServletWebServerFactory) configurableServletWebServerFactory;
container.addServerCustomizers(jettyKeycloakServerCustomizer());
}
}
};
}
use of org.springframework.boot.web.server.WebServerFactoryCustomizer in project joinfaces by joinfaces.
the class UndertowAutoConfiguration method jsfUndertowFactoryCustomizer.
@Bean
public WebServerFactoryCustomizer<UndertowServletWebServerFactory> jsfUndertowFactoryCustomizer() {
return factory -> factory.addDeploymentInfoCustomizers(deploymentInfo -> {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
ClassLoader jsfClassLoader = new URLClassLoader(new URL[0], this.getClass().getClassLoader());
deploymentInfo.setClassLoader(jsfClassLoader);
deploymentInfo.setResourceManager(new ClassPathResourceManager(jsfClassLoader, this.undertowProperties.getClassPathResource()));
return null;
});
log.info("Setting Undertow classLoader to {} directory", this.undertowProperties.getClassPathResource());
});
}
Aggregations