org.springframework.boot.web.server.WebServerFactory Java Examples
The following examples show how to use
org.springframework.boot.web.server.WebServerFactory.
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: WebConfigurer.java From TeamDojo with Apache License 2.0 | 6 votes |
/** * Customize the Servlet engine: Mime types, the document root, the cache. */ @Override public void customize(WebServerFactory server) { setMimeMappings(server); // When running in an IDE or with ./gradlew bootRun, set location of the static web assets. setLocationForStaticAssets(server); /* * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288 * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1. * See the JHipsterProperties class and your application-*.yml configuration files * for more information. */ if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); } }
Example #2
Source File: WebConfigurer.java From albedo with GNU Lesser General Public License v3.0 | 6 votes |
/** * Customize the Servlet engine: Mime types, the document root, the cache. */ @Override public void customize(WebServerFactory server) { setMimeMappings(server); // When running in an IDE or with ./mvnw spring-boot:run, set location // of the static web assets. setLocationForStaticAssets(server); /* * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288 * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1. * See the ApplicationProperties class and your application-*.yml configuration files * for more information. */ if (applicationProperties.getHttp().getVersion().equals(ApplicationProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); } }
Example #3
Source File: PortalTomcatWebServerCustomizer.java From seppb with MIT License | 5 votes |
@Override public void customize(WebServerFactory container) { TomcatServletWebServerFactory containerFactory = (TomcatServletWebServerFactory) container; containerFactory.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> { connector.setAttribute("relaxedQueryChars", "[]|{}^\" < > "); connector.setAttribute("relaxedPathChars", "[]|"); }); }
Example #4
Source File: WebConfigurer.java From TeamDojo with Apache License 2.0 | 5 votes |
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); } }
Example #5
Source File: WebConfigurer.java From albedo with GNU Lesser General Public License v3.0 | 5 votes |
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); } }
Example #6
Source File: WebConfigurer.java From jhipster-registry with Apache License 2.0 | 5 votes |
/** * Customize the Servlet engine: Mime types, the document root, the cache. */ @Override public void customize(WebServerFactory server) { setMimeMappings(server); // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets. setLocationForStaticAssets(server); }
Example #7
Source File: WebConfigurer.java From jhipster-registry with Apache License 2.0 | 5 votes |
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); } }