use of org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizerTests method deduceUseForwardHeadersUndertow.
@Test
public void deduceUseForwardHeadersUndertow() throws Exception {
this.customizer.setEnvironment(new MockEnvironment().withProperty("DYNO", "-"));
UndertowServletWebServerFactory factory = spy(new UndertowServletWebServerFactory());
this.customizer.customize(factory);
verify(factory).setUseForwardHeaders(true);
}
use of org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizerTests method setUseForwardHeadersUndertow.
@Test
public void setUseForwardHeadersUndertow() throws Exception {
this.properties.setUseForwardHeaders(true);
UndertowServletWebServerFactory factory = spy(new UndertowServletWebServerFactory());
this.customizer.customize(factory);
verify(factory).setUseForwardHeaders(true);
}
use of org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory in project jhipster-sample-app-cassandra 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 jhipster-sample-app-cassandra 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-hazelcast 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();
}
Aggregations