当前位置: 首页>>代码示例>>Java>>正文


Java UndertowEmbeddedServletContainerFactory类代码示例

本文整理汇总了Java中org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory的典型用法代码示例。如果您正苦于以下问题:Java UndertowEmbeddedServletContainerFactory类的具体用法?Java UndertowEmbeddedServletContainerFactory怎么用?Java UndertowEmbeddedServletContainerFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UndertowEmbeddedServletContainerFactory类属于org.springframework.boot.context.embedded.undertow包,在下文中一共展示了UndertowEmbeddedServletContainerFactory类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: customize

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:27,代码来源:WebConfigurer.java

示例2: customize

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:29,代码来源:WebConfigurer.java

示例3: testCustomizeServletContainer

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
@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();
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:18,代码来源:WebConfigurerTest.java

示例4: purgeAccessLogCustomizer

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
/**
 * 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);
    };
}
 
开发者ID:marcosbarbero,项目名称:spring-boot-starter-purge-accesslog,代码行数:23,代码来源:PurgeAccessLogAutoConfiguration.java

示例5: customize

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:michaelhoffmantech,项目名称:patient-portal,代码行数:29,代码来源:WebConfigurer.java

示例6: testCustomizeServletContainer

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
@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();
}
 
开发者ID:michaelhoffmantech,项目名称:patient-portal,代码行数:18,代码来源:WebConfigurerTest.java

示例7: customize

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:torgcrm,项目名称:TorgCRM-Server,代码行数:29,代码来源:WebConfigurer.java

示例8: embeddedServletContainerFactory

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
@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;
}
 
开发者ID:openmicroscopy,项目名称:omero-ms-queue,代码行数:24,代码来源:WebWiring.java

示例9: testCustomizeServletContainer

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
@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();
}
 
开发者ID:deepu105,项目名称:spring-io,代码行数:18,代码来源:WebConfigurerTest.java

示例10: customize

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
/**
 * 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));
	}
}
 
开发者ID:alikemalocalan,项目名称:MicroBlog,代码行数:29,代码来源:WebConfigurer.java

示例11: testCustomizeServletContainer

import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; //导入依赖的package包/类
@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();
}
 
开发者ID:alikemalocalan,项目名称:MicroBlog,代码行数:18,代码来源:WebConfigurerTest.java


注:本文中的org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。