parent
7efdb91641
commit
ab2a2579c8
|
@ -658,15 +658,15 @@ public class ServerProperties
|
||||||
private Charset uriEncoding;
|
private Charset uriEncoding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum amount of connections accept and process.
|
* Maximum number of connections that the server will accept and process
|
||||||
* <p>Once the limit has been reached,
|
* at any given time. Once the limit has been reached, the operating system
|
||||||
* the operating system may still accept connections based on the @link{acceptCount} setting.</p>
|
* may still accept connections based on the "acceptCount" property.
|
||||||
*/
|
*/
|
||||||
private int maxConnections = 0;
|
private int maxConnections = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum queue length for incoming connection requests when all possible request processing threads are in use.
|
* Maximum queue length for incoming connection requests when all possible
|
||||||
* Any requests received when the queue is full will be refused.
|
* request processing threads are in use.
|
||||||
*/
|
*/
|
||||||
private int acceptCount = 0;
|
private int acceptCount = 0;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import javax.servlet.SessionTrackingMode;
|
||||||
import org.apache.catalina.Context;
|
import org.apache.catalina.Context;
|
||||||
import org.apache.catalina.Valve;
|
import org.apache.catalina.Valve;
|
||||||
import org.apache.catalina.valves.RemoteIpValve;
|
import org.apache.catalina.valves.RemoteIpValve;
|
||||||
|
import org.apache.coyote.AbstractProtocol;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
@ -324,22 +325,6 @@ public class ServerPropertiesTests {
|
||||||
assertThat(this.properties.getTomcat().getMinSpareThreads()).isEqualTo(10);
|
assertThat(this.properties.getTomcat().getMinSpareThreads()).isEqualTo(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCustomizeTomcatAcceptCount() throws Exception {
|
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
|
||||||
map.put("server.tomcat.accept-count", "10");
|
|
||||||
bindProperties(map);
|
|
||||||
assertThat(this.properties.getTomcat().getAcceptCount()).isEqualTo(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCustomizeTomcatMaxConnections() throws Exception {
|
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
|
||||||
map.put("server.tomcat.max-connections", "5");
|
|
||||||
bindProperties(map);
|
|
||||||
assertThat(this.properties.getTomcat().getMaxConnections()).isEqualTo(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void customizeTomcatDisplayName() throws Exception {
|
public void customizeTomcatDisplayName() throws Exception {
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
@ -451,6 +436,34 @@ public class ServerPropertiesTests {
|
||||||
assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1");
|
assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void customTomcatAcceptCount() {
|
||||||
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
map.put("server.tomcat.accept-count", "10");
|
||||||
|
bindProperties(map);
|
||||||
|
|
||||||
|
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
|
||||||
|
this.properties.customize(container);
|
||||||
|
TomcatEmbeddedServletContainer embeddedContainer =
|
||||||
|
(TomcatEmbeddedServletContainer) container.getEmbeddedServletContainer();
|
||||||
|
assertThat(((AbstractProtocol) embeddedContainer.getTomcat().getConnector()
|
||||||
|
.getProtocolHandler()).getBacklog()).isEqualTo(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void customTomcatMaxConnections() {
|
||||||
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
map.put("server.tomcat.max-connections", "5");
|
||||||
|
bindProperties(map);
|
||||||
|
|
||||||
|
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
|
||||||
|
this.properties.customize(container);
|
||||||
|
TomcatEmbeddedServletContainer embeddedContainer =
|
||||||
|
(TomcatEmbeddedServletContainer) container.getEmbeddedServletContainer();
|
||||||
|
assertThat(((AbstractProtocol) embeddedContainer.getTomcat().getConnector()
|
||||||
|
.getProtocolHandler()).getMaxConnections()).isEqualTo(5);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void defaultUseForwardHeadersUndertow() throws Exception {
|
public void defaultUseForwardHeadersUndertow() throws Exception {
|
||||||
UndertowEmbeddedServletContainerFactory container = spy(
|
UndertowEmbeddedServletContainerFactory container = spy(
|
||||||
|
|
|
@ -193,6 +193,7 @@ content into your application; rather pick only the properties that you need.
|
||||||
server.ssl.trust-store-password= # Password used to access the trust store.
|
server.ssl.trust-store-password= # Password used to access the trust store.
|
||||||
server.ssl.trust-store-provider= # Provider for the trust store.
|
server.ssl.trust-store-provider= # Provider for the trust store.
|
||||||
server.ssl.trust-store-type= # Type of the trust store.
|
server.ssl.trust-store-type= # Type of the trust store.
|
||||||
|
server.tomcat.accept-count= # Maximum queue length for incoming connection requests when all possible request processing threads are in use.
|
||||||
server.tomcat.accesslog.directory=logs # Directory in which log files are created. Can be relative to the tomcat base dir or absolute.
|
server.tomcat.accesslog.directory=logs # Directory in which log files are created. Can be relative to the tomcat base dir or absolute.
|
||||||
server.tomcat.accesslog.enabled=false # Enable access log.
|
server.tomcat.accesslog.enabled=false # Enable access log.
|
||||||
server.tomcat.accesslog.pattern=common # Format pattern for access logs.
|
server.tomcat.accesslog.pattern=common # Format pattern for access logs.
|
||||||
|
@ -208,6 +209,7 @@ content into your application; rather pick only the properties that you need.
|
||||||
172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\
|
172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\
|
||||||
172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\
|
172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\
|
||||||
172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3} # regular expression matching trusted IP addresses.
|
172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3} # regular expression matching trusted IP addresses.
|
||||||
|
server.tomcat.max-connections= # Maximum number of connections that the server will accept and process at any given time.
|
||||||
server.tomcat.max-threads=0 # Maximum amount of worker threads.
|
server.tomcat.max-threads=0 # Maximum amount of worker threads.
|
||||||
server.tomcat.min-spare-threads=0 # Minimum amount of worker threads.
|
server.tomcat.min-spare-threads=0 # 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.port-header=X-Forwarded-Port # Name of the HTTP header used to override the original port value.
|
||||||
|
|
Loading…
Reference in New Issue