Java 类org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory 实例源码

项目:logback-access-spring-boot-starter    文件:UndertowLogbackAccessInstaller.java   
/** {@inheritDoc} */
@Override
protected void installLogbackAccess(UndertowServletWebServerFactory container) {
    container.addBuilderCustomizers(this::enableRecordingRequestStartTime);
    container.addDeploymentInfoCustomizers(this::addUndertowHttpHandlerWrapper);
    log.debug("Installed Logback-access: container=[{}]", container);
}
项目:generator-jhipster    文件:_WebConfigurer.java   
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);
    }
}
项目:generator-jhipster    文件:_WebConfigurer.java   
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);
        }
    }
}
项目:generator-jhipster    文件:_WebConfigurerTest.java   
@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();
}
项目:servlet4-demo    文件:Application.java   
@Bean
public UndertowServletWebServerFactory embeddedServletContainerFactory() {
  UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory();
  factory.addBuilderCustomizers(this::customize);
  return factory;
}
项目:joinfaces    文件:UndertowSpringBootAutoConfiguration.java   
@Override
public void customize(UndertowServletWebServerFactory container) {
    container.addDeploymentInfoCustomizers(new JsfUndertowDeploymentInfoCustomizer(this.undertowProperties));
}
项目:joinfaces    文件:UndertowTestConfiguration.java   
@Bean
public UndertowServletWebServerFactory undertowServletWebServerFactory() {
    return new UndertowServletWebServerFactory();
}
项目:joinfaces    文件:UndertowSpringBootAutoConfigurationIT.java   
@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();
}