Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
ab2a2579
Commit
ab2a2579
authored
Oct 10, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish contribution
Closes gh-6571
parent
7efdb916
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
21 deletions
+36
-21
ServerProperties.java
...ingframework/boot/autoconfigure/web/ServerProperties.java
+5
-5
ServerPropertiesTests.java
...amework/boot/autoconfigure/web/ServerPropertiesTests.java
+29
-16
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+2
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java
View file @
ab2a2579
...
...
@@ -658,15 +658,15 @@ public class ServerProperties
private
Charset
uriEncoding
;
/**
* Maximum
amount of connections accept and process.
*
<p>Once the limit has been reached,
*
the operating system may still accept connections based on the @link{acceptCount} setting.</p>
* Maximum
number of connections that the server will accept and process
*
at any given time. Once the limit has been reached, the operating system
*
may still accept connections based on the "acceptCount" property.
*/
private
int
maxConnections
=
0
;
/**
* Maximum queue length for incoming connection requests when all possible
request processing threads are in use.
*
Any requests received when the queue is full will be refused
.
* Maximum queue length for incoming connection requests when all possible
*
request processing threads are in use
.
*/
private
int
acceptCount
=
0
;
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
View file @
ab2a2579
...
...
@@ -32,6 +32,7 @@ import javax.servlet.SessionTrackingMode;
import
org.apache.catalina.Context
;
import
org.apache.catalina.Valve
;
import
org.apache.catalina.valves.RemoteIpValve
;
import
org.apache.coyote.AbstractProtocol
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.mockito.ArgumentCaptor
;
...
...
@@ -324,22 +325,6 @@ public class ServerPropertiesTests {
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
public
void
customizeTomcatDisplayName
()
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
...
...
@@ -451,6 +436,34 @@ public class ServerPropertiesTests {
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
public
void
defaultUseForwardHeadersUndertow
()
throws
Exception
{
UndertowEmbeddedServletContainerFactory
container
=
spy
(
...
...
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
ab2a2579
...
...
@@ -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-provider= # Provider for 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.enabled=false # Enable access log.
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\\.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.
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.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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment