Browse Source

Polish contribution

Closes gh-15054
pull/15385/head
Stephane Nicoll 7 years ago
parent
commit
1b40b0edf1
  1. 14
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java
  2. 6
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
  3. 2
      spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

14
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java

@ -136,6 +136,13 @@ public class TomcatWebServerFactoryCustomizer implements @@ -136,6 +136,13 @@ public class TomcatWebServerFactoryCustomizer implements
});
}
private void customizeProcessorCache(ConfigurableTomcatWebServerFactory factory,
int processorCache) {
factory.addConnectorCustomizers((
connector) -> ((AbstractHttp11Protocol<?>) connector.getProtocolHandler())
.setProcessorCache(processorCache));
}
private void customizeMaxConnections(ConfigurableTomcatWebServerFactory factory,
int maxConnections) {
factory.addConnectorCustomizers((connector) -> {
@ -158,13 +165,6 @@ public class TomcatWebServerFactoryCustomizer implements @@ -158,13 +165,6 @@ public class TomcatWebServerFactoryCustomizer implements
});
}
private void customizeProcessorCache(ConfigurableTomcatWebServerFactory factory,
int processorCache) {
factory.addConnectorCustomizers((
connector) -> ((AbstractHttp11Protocol<?>) connector.getProtocolHandler())
.setProcessorCache(processorCache));
}
private void customizeRemoteIpValve(ConfigurableTomcatWebServerFactory factory) {
Tomcat tomcatProperties = this.serverProperties.getTomcat();
String protocolHeader = tomcatProperties.getProtocolHeader();

6
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java

@ -206,6 +206,12 @@ public class ServerPropertiesTests { @@ -206,6 +206,12 @@ public class ServerPropertiesTests {
.isEqualTo(getDefaultProtocol().getAcceptCount());
}
@Test
public void tomcatProcessorCacheMatchesProtocolDefault() throws Exception {
assertThat(this.properties.getTomcat().getProcessorCache())
.isEqualTo(getDefaultProtocol().getProcessorCache());
}
@Test
public void tomcatMaxConnectionsMatchesProtocolDefault() throws Exception {
assertThat(this.properties.getTomcat().getMaxConnections())

2
spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

@ -276,7 +276,7 @@ content into your application. Rather, pick only the properties that you need. @@ -276,7 +276,7 @@ content into your application. Rather, pick only the properties that you need.
server.tomcat.max-threads=200 # Maximum amount of worker threads.
server.tomcat.min-spare-threads=10 # Minimum amount of worker threads.
server.tomcat.port-header=X-Forwarded-Port # Name of the HTTP header used to override the original port value.
server.tomcat.processor-cache= # Maximum number of idle processors that will be retained in the cache and reused with a subsequent request.
server.tomcat.processor-cache=200 # Maximum number of idle processors that will be retained in the cache and reused with a subsequent request.
server.tomcat.protocol-header= # Header that holds the incoming protocol, usually named "X-Forwarded-Proto".
server.tomcat.protocol-header-https-value=https # Value of the protocol header indicating whether the incoming request uses SSL.
server.tomcat.redirect-context-root=true # Whether requests to the context root should be redirected by appending a / to the path.

Loading…
Cancel
Save