Add Http2 configuration properties
This commit adds a new configuration properties class for configuring HTTP/2 protocol support. By default, this protocol is disabled as enabling it requires several manual changes: * configuring a web server for proper TLS and ALPN support * configuring a proper SSL certificate See gh-10043
This commit is contained in:
@@ -31,6 +31,7 @@ import java.util.TimeZone;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.boot.web.server.Compression;
|
||||
import org.springframework.boot.web.server.Http2;
|
||||
import org.springframework.boot.web.server.Ssl;
|
||||
import org.springframework.boot.web.servlet.server.Jsp;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -102,6 +103,9 @@ public class ServerProperties {
|
||||
@NestedConfigurationProperty
|
||||
private Compression compression = new Compression();
|
||||
|
||||
@NestedConfigurationProperty
|
||||
private Http2 http2 = new Http2();
|
||||
|
||||
private Servlet servlet = new Servlet();
|
||||
|
||||
private final Tomcat tomcat = new Tomcat();
|
||||
@@ -190,6 +194,10 @@ public class ServerProperties {
|
||||
return this.compression;
|
||||
}
|
||||
|
||||
public Http2 getHttp2() {
|
||||
return this.http2;
|
||||
}
|
||||
|
||||
public Servlet getServlet() {
|
||||
return this.servlet;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,9 @@ public class DefaultReactiveWebServerCustomizer implements
|
||||
if (this.serverProperties.getCompression() != null) {
|
||||
server.setCompression(this.serverProperties.getCompression());
|
||||
}
|
||||
if (this.serverProperties.getHttp2() != null) {
|
||||
server.setHttp2(this.serverProperties.getHttp2());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -120,6 +120,9 @@ public class DefaultServletWebServerFactoryCustomizer
|
||||
if (this.serverProperties.getCompression() != null) {
|
||||
factory.setCompression(this.serverProperties.getCompression());
|
||||
}
|
||||
if (this.serverProperties.getHttp2() != null) {
|
||||
factory.setHttp2(this.serverProperties.getHttp2());
|
||||
}
|
||||
factory.setServerHeader(this.serverProperties.getServerHeader());
|
||||
if (factory instanceof TomcatServletWebServerFactory) {
|
||||
TomcatCustomizer.customizeTomcat(this.serverProperties, this.environment,
|
||||
|
||||
Reference in New Issue
Block a user