use of org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory in project jhipster-sample-app-hazelcast by jhipster.
the class WebConfigurerTest method testUndertowHttp2Enabled.
@Test
public void testUndertowHttp2Enabled() {
props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
webConfigurer.customize(container);
Builder builder = Undertow.builder();
container.getBuilderCustomizers().forEach(c -> c.customize(builder));
OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
use of org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory in project jhipster-sample-app-elasticsearch by jhipster.
the class WebConfigurerTest method testUndertowHttp2Enabled.
@Test
public void testUndertowHttp2Enabled() {
props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
webConfigurer.customize(container);
Builder builder = Undertow.builder();
container.getBuilderCustomizers().forEach(c -> c.customize(builder));
OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
use of org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory in project jhipster-sample-app-elasticsearch by jhipster.
the class WebConfigurerTest method testCustomizeServletContainer.
@Test
public void testCustomizeServletContainer() {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
webConfigurer.customize(container);
assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
if (container.getDocumentRoot() != null) {
assertThat(container.getDocumentRoot().getPath()).isEqualTo(FilenameUtils.separatorsToSystem("target/www"));
}
Builder builder = Undertow.builder();
container.getBuilderCustomizers().forEach(c -> c.customize(builder));
OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}
use of org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizer method customize.
@Override
public void customize(ConfigurableServletWebServerFactory factory) {
if (this.serverProperties.getPort() != null) {
factory.setPort(this.serverProperties.getPort());
}
if (this.serverProperties.getAddress() != null) {
factory.setAddress(this.serverProperties.getAddress());
}
if (this.serverProperties.getServlet().getContextPath() != null) {
factory.setContextPath(this.serverProperties.getServlet().getContextPath());
}
if (this.serverProperties.getDisplayName() != null) {
factory.setDisplayName(this.serverProperties.getDisplayName());
}
if (this.serverProperties.getSession().getTimeout() != null) {
factory.setSessionTimeout(this.serverProperties.getSession().getTimeout());
}
factory.setPersistSession(this.serverProperties.getSession().isPersistent());
factory.setSessionStoreDir(this.serverProperties.getSession().getStoreDir());
if (this.serverProperties.getSsl() != null) {
factory.setSsl(this.serverProperties.getSsl());
}
if (this.serverProperties.getServlet() != null) {
factory.setJsp(this.serverProperties.getServlet().getJsp());
}
if (this.serverProperties.getCompression() != null) {
factory.setCompression(this.serverProperties.getCompression());
}
factory.setServerHeader(this.serverProperties.getServerHeader());
if (factory instanceof TomcatServletWebServerFactory) {
TomcatCustomizer.customizeTomcat(this.serverProperties, this.environment, (TomcatServletWebServerFactory) factory);
}
if (factory instanceof JettyServletWebServerFactory) {
JettyCustomizer.customizeJetty(this.serverProperties, this.environment, (JettyServletWebServerFactory) factory);
}
if (factory instanceof UndertowServletWebServerFactory) {
UndertowCustomizer.customizeUndertow(this.serverProperties, this.environment, (UndertowServletWebServerFactory) factory);
}
factory.addInitializers(new SessionConfiguringInitializer(this.serverProperties.getSession()));
factory.addInitializers(new InitParameterConfiguringServletContextInitializer(this.serverProperties.getServlet().getContextParameters()));
}
use of org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizerTests method defaultUseForwardHeadersUndertow.
@Test
public void defaultUseForwardHeadersUndertow() throws Exception {
UndertowServletWebServerFactory factory = spy(new UndertowServletWebServerFactory());
this.customizer.customize(factory);
verify(factory).setUseForwardHeaders(false);
}
Aggregations