/** {@inheritDoc} */ @Override protected void installLogbackAccess(UndertowServletWebServerFactory container) { container.addBuilderCustomizers(this::enableRecordingRequestStartTime); container.addDeploymentInfoCustomizers(this::addUndertowHttpHandlerWrapper); log.debug("Installed Logback-access: container=[{}]", container); }
private void setMimeMappings(WebServerFactory server) { if (server instanceof UndertowServletWebServerFactory) { 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=utf-8"); // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64 mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=utf-8"); UndertowServletWebServerFactory undertow = (UndertowServletWebServerFactory) server; undertow.setMimeMappings(mappings); } }
private void setLocationForStaticAssets(WebServerFactory server) { if (server instanceof UndertowServletWebServerFactory) { UndertowServletWebServerFactory undertow = (UndertowServletWebServerFactory) server; File root; String prefixPath = resolvePathPrefix(); root = new File(prefixPath + "<%= CLIENT_DIST_DIR %>"); if (root.exists() && root.isDirectory()) { undertow.setDocumentRoot(root); } } }
@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(); }
@Bean public UndertowServletWebServerFactory embeddedServletContainerFactory() { UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory(); factory.addBuilderCustomizers(this::customize); return factory; }
@Override public void customize(UndertowServletWebServerFactory container) { container.addDeploymentInfoCustomizers(new JsfUndertowDeploymentInfoCustomizer(this.undertowProperties)); }
@Bean public UndertowServletWebServerFactory undertowServletWebServerFactory() { return new UndertowServletWebServerFactory(); }
@Test public void customize() throws IOException { UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory(); this.undertowSpringBootAutoConfiguration.customize(factory); UndertowDeploymentInfoCustomizer undertowDeploymentInfoCustomizer = factory.getDeploymentInfoCustomizers().iterator().next(); DeploymentInfo deploymentInfo = new DeploymentInfo(); undertowDeploymentInfoCustomizer.customize(deploymentInfo); assertThat(deploymentInfo.getResourceManager().getResource("testUndertow.txt")) .isNotNull(); }