|
|
|
@ -27,6 +27,7 @@ import org.apache.catalina.valves.AccessLogValve; |
|
|
|
import org.apache.catalina.valves.RemoteIpValve; |
|
|
|
import org.apache.catalina.valves.RemoteIpValve; |
|
|
|
import org.apache.coyote.AbstractProtocol; |
|
|
|
import org.apache.coyote.AbstractProtocol; |
|
|
|
import org.apache.coyote.ProtocolHandler; |
|
|
|
import org.apache.coyote.ProtocolHandler; |
|
|
|
|
|
|
|
import org.apache.coyote.http11.AbstractHttp11Protocol; |
|
|
|
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; |
|
|
|
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; |
|
|
|
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; |
|
|
|
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; |
|
|
|
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor; |
|
|
|
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor; |
|
|
|
@ -41,7 +42,7 @@ import org.springframework.util.StringUtils; |
|
|
|
* {@link ConfigurationProperties properties} for a web server (e.g. port and path |
|
|
|
* {@link ConfigurationProperties properties} for a web server (e.g. port and path |
|
|
|
* settings). Will be used to customize an {@link EmbeddedServletContainerFactory} when an |
|
|
|
* settings). Will be used to customize an {@link EmbeddedServletContainerFactory} when an |
|
|
|
* {@link EmbeddedServletContainerCustomizerBeanPostProcessor} is active. |
|
|
|
* {@link EmbeddedServletContainerCustomizerBeanPostProcessor} is active. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Dave Syer |
|
|
|
* @author Dave Syer |
|
|
|
* @author Stephane Nicoll |
|
|
|
* @author Stephane Nicoll |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -145,6 +146,8 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer { |
|
|
|
|
|
|
|
|
|
|
|
private int maxThreads = 0; // Number of threads in protocol handler
|
|
|
|
private int maxThreads = 0; // Number of threads in protocol handler
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int maxHttpHeaderSize = 0; // bytes
|
|
|
|
|
|
|
|
|
|
|
|
private String uriEncoding; |
|
|
|
private String uriEncoding; |
|
|
|
|
|
|
|
|
|
|
|
public int getMaxThreads() { |
|
|
|
public int getMaxThreads() { |
|
|
|
@ -155,6 +158,14 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer { |
|
|
|
this.maxThreads = maxThreads; |
|
|
|
this.maxThreads = maxThreads; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getMaxHttpHeaderSize() { |
|
|
|
|
|
|
|
return maxHttpHeaderSize; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setMaxHttpHeaderSize(int maxHttpHeaderSize) { |
|
|
|
|
|
|
|
this.maxHttpHeaderSize = maxHttpHeaderSize; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean getAccessLogEnabled() { |
|
|
|
public boolean getAccessLogEnabled() { |
|
|
|
return this.accessLogEnabled; |
|
|
|
return this.accessLogEnabled; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -246,6 +257,19 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.maxHttpHeaderSize > 0) { |
|
|
|
|
|
|
|
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void customize(Connector connector) { |
|
|
|
|
|
|
|
ProtocolHandler handler = connector.getProtocolHandler(); |
|
|
|
|
|
|
|
if (handler instanceof AbstractHttp11Protocol) { |
|
|
|
|
|
|
|
AbstractHttp11Protocol protocol = (AbstractHttp11Protocol) handler; |
|
|
|
|
|
|
|
protocol.setMaxHttpHeaderSize(Tomcat.this.maxHttpHeaderSize); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.accessLogEnabled) { |
|
|
|
if (this.accessLogEnabled) { |
|
|
|
AccessLogValve valve = new AccessLogValve(); |
|
|
|
AccessLogValve valve = new AccessLogValve(); |
|
|
|
String accessLogPattern = getAccessLogPattern(); |
|
|
|
String accessLogPattern = getAccessLogPattern(); |
|
|
|
|