use of org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizerTests method testCustomizeDisplayName.
@Test
public void testCustomizeDisplayName() throws Exception {
ConfigurableServletWebServerFactory factory = mock(ConfigurableServletWebServerFactory.class);
this.properties.setDisplayName("TestName");
this.customizer.customize(factory);
verify(factory).setDisplayName("TestName");
}
use of org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory in project jhipster-sample-app-mongodb by jhipster.
the class WebConfigurer method setMimeMappings.
private void setMimeMappings(WebServerFactory server) {
if (server instanceof ConfigurableServletWebServerFactory) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
// IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server;
servletWebServer.setMimeMappings(mappings);
}
}
use of org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory in project jhipster-sample-app-hazelcast by jhipster.
the class WebConfigurer method setMimeMappings.
private void setMimeMappings(WebServerFactory server) {
if (server instanceof ConfigurableServletWebServerFactory) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
// IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server;
servletWebServer.setMimeMappings(mappings);
}
}
use of org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory in project jhipster-sample-app-elasticsearch by jhipster.
the class WebConfigurer method setLocationForStaticAssets.
private void setLocationForStaticAssets(WebServerFactory server) {
if (server instanceof ConfigurableServletWebServerFactory) {
ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server;
File root;
String prefixPath = resolvePathPrefix();
root = new File(prefixPath + "target/www/");
if (root.exists() && root.isDirectory()) {
servletWebServer.setDocumentRoot(root);
}
}
}
use of org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory in project spring-boot by spring-projects.
the class ServletWebServerFactoryCustomizerTests method whenShutdownPropertyIsSetThenShutdownIsCustomized.
@Test
void whenShutdownPropertyIsSetThenShutdownIsCustomized() {
Map<String, String> map = new HashMap<>();
map.put("server.shutdown", "graceful");
bindProperties(map);
ConfigurableServletWebServerFactory factory = mock(ConfigurableServletWebServerFactory.class);
this.customizer.customize(factory);
ArgumentCaptor<Shutdown> shutdownCaptor = ArgumentCaptor.forClass(Shutdown.class);
then(factory).should().setShutdown(shutdownCaptor.capture());
assertThat(shutdownCaptor.getValue()).isEqualTo(Shutdown.GRACEFUL);
}
Aggregations