Java 类org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory 实例源码

项目:xm-uaa    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:jhipster-microservices-example    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:jhipster-microservices-example    文件:WebConfigurerTest.java   
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    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();
}
项目:jhipster-microservices-example    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:jhipster-microservices-example    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:MTC_Labrat    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:spring-boot-starter-purge-accesslog    文件:PurgeAccessLogAutoConfiguration.java   
/**
 * Purge access log customizer embedded servlet container customizer.
 *
 * @param serverProperties the server properties
 * @param purgeProperties  the purge properties
 * @return the embedded servlet container customizer
 */
@Bean
public EmbeddedServletContainerCustomizer purgeAccessLogCustomizer(
        final ServerProperties serverProperties,
        final PurgeProperties purgeProperties) {
    return container -> {
        final UndertowEmbeddedServletContainerFactory factory = (UndertowEmbeddedServletContainerFactory)
                container;
        final Undertow.Accesslog accesslog = serverProperties.getUndertow()
                .getAccesslog();
        final UndertowPurgeAccessLogHolder accessLogHolder = new UndertowPurgeAccessLogHolder(
                purgeProperties, accesslog.getDir().toPath(),
                accesslog.getPrefix(), accesslog.getSuffix());
        factory.addDeploymentInfoCustomizers(accessLogHolder);
    };
}
项目:xm-ms-balance    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:Armory    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:xm-ms-dashboard    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:patient-portal    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./gradlew bootRun, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:patient-portal    文件:WebConfigurerTest.java   
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    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("build/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();
}
项目:xm-gate    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:TorgCRM-Server    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    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");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:TorgCRM-Server    文件:WebConfigurerTest.java   
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    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();
}
项目:speakTogether    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./gradlew bootRun, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:omero-ms-queue    文件:WebWiring.java   
@Bean
public UndertowEmbeddedServletContainerFactory 
            embeddedServletContainerFactory(
                    ConfigProvider<UndertowConfig> cfg) {

    int port = cfg.defaultReadConfig().findFirst().get().getPort();

    UndertowEmbeddedServletContainerFactory factory = 
            new UndertowEmbeddedServletContainerFactory(port);

    factory.addBuilderCustomizers((UndertowBuilderCustomizer) builder -> {  // (*)
        builder.setServerOption(UndertowOptions.DECODE_URL, true);
        builder.setServerOption(UndertowOptions.URL_CHARSET,
                                StandardCharsets.UTF_8.name());
    });

    factory.addDeploymentInfoCustomizers(
            (UndertowDeploymentInfoCustomizer) deployment -> {  // (*)
        deployment.setDefaultEncoding(StandardCharsets.UTF_8.name());
    });

    return factory;
}
项目:xm-ms-entity    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:spring-io    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./gradlew bootRun, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:spring-io    文件:WebConfigurerTest.java   
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    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("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();
}
项目:spring-io    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./gradlew bootRun, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:spring-io    文件:WebConfigurerTest.java   
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    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("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();
}
项目:spring-io    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:spring-io    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:xm-ms-timeline    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:devoxxus-jhipster-microservices-demo    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:devoxxus-jhipster-microservices-demo    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:codemotion-2017-taller-de-jhipster    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:codemotion-2017-taller-de-jhipster    文件:WebConfigurerTest.java   
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    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();
}
项目:xm-ms-config    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:qualitoast    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    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");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:qualitoast    文件:WebConfigurerTest.java   
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    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();
}
项目:Microservices-with-JHipster-and-Spring-Boot    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:Microservices-with-JHipster-and-Spring-Boot    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:java-hostel    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:jhipster-registry    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:MicroBlog    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

       /*
        * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:MicroBlog    文件:WebConfigurerTest.java   
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    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();
}
项目:trivor    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * 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) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:trivor    文件:WebConfigurerTest.java   
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    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();
}