类org.springframework.boot.web.server.WebServerFactory源码实例Demo

下面列出了怎么用org.springframework.boot.web.server.WebServerFactory的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TeamDojo   文件: WebConfigurer.java
/**
 * 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));
    }
}
 
源代码2 项目: albedo   文件: WebConfigurer.java
/**
 * 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));
	}

}
 
源代码3 项目: seppb   文件: PortalTomcatWebServerCustomizer.java
@Override
public void customize(WebServerFactory container) {
    TomcatServletWebServerFactory containerFactory = (TomcatServletWebServerFactory) container;
    containerFactory.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
        connector.setAttribute("relaxedQueryChars", "[]|{}^\" < > ");
        connector.setAttribute("relaxedPathChars", "[]|");
    });
}
 
源代码4 项目: TeamDojo   文件: WebConfigurer.java
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);
    }
}
 
源代码5 项目: albedo   文件: WebConfigurer.java
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);
	}
}
 
源代码6 项目: jhipster-registry   文件: WebConfigurer.java
/**
 * 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);
}
 
源代码7 项目: jhipster-registry   文件: WebConfigurer.java
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);
    }
}
 
 类所在包
 类方法
 同包方法