FELIX-3162 Allow the configuration of three Jetty buffers: Header, Request, and Response buffers. In addition the default of the header buffer is increased to 16KB as opposed to the Jetty default of 4KB which is not enough for Cookie heavy requests.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1197051 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
index 6a8d6a2..6ddfb97 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
@@ -79,6 +79,15 @@
/** Felix specific property to configure the session timeout in minutes (same session-timout in web.xml). Default is servlet container specific */
public static final String FELIX_SESSION_TIMEOUT = "org.apache.felix.http.session.timeout";
+ /** Felix speicific property to configure the request buffer size. Default is 16KB (instead of Jetty's default of 4KB) */
+ public static final String FELIX_JETTY_HEADER_BUFFER_SIZE = "org.apache.felix.http.jetty.headerBufferSize";
+
+ /** Felix speicific property to configure the request buffer size. Default is 8KB */
+ public static final String FELIX_JETTY_REQUEST_BUFFER_SIZE = "org.apache.felix.http.jetty.requestBufferSize";
+
+ /** Felix speicific property to configure the request buffer size. Default is 24KB */
+ public static final String FELIX_JETTY_RESPONSE_BUFFER_SIZE = "org.apache.felix.http.jetty.responseBufferSize";
+
/** Felix specific property to enable Jetty MBeans. Valid values are "true", "false". Default is false */
public static final String FELIX_HTTP_MBEANS = "org.apache.felix.http.mbeans";
@@ -100,6 +109,9 @@
private boolean useHttpsNio;
private boolean registerMBeans;
private int sessionTimeout;
+ private int headerBufferSize;
+ private int requestBufferSize;
+ private int responseBufferSize;
/**
* Properties from the configuration not matching any of the
@@ -216,6 +228,21 @@
return this.sessionTimeout;
}
+ public int getHeaderBufferSize()
+ {
+ return this.headerBufferSize;
+ }
+
+ public int getRequestBufferSize()
+ {
+ return this.requestBufferSize;
+ }
+
+ public int getResponseBufferSize()
+ {
+ return this.responseBufferSize;
+ }
+
public void reset()
{
update(null);
@@ -244,6 +271,9 @@
this.useHttpsNio = getBooleanProperty(props, FELIX_HTTPS_NIO, this.useHttpNio);
this.registerMBeans = getBooleanProperty(props, FELIX_HTTP_MBEANS, false);
this.sessionTimeout = getIntProperty(props, FELIX_SESSION_TIMEOUT, 0);
+ this.headerBufferSize = getIntProperty(FELIX_JETTY_HEADER_BUFFER_SIZE, 16 * 1024);
+ this.requestBufferSize = getIntProperty(FELIX_JETTY_REQUEST_BUFFER_SIZE, 8 * 014);
+ this.responseBufferSize = getIntProperty(FELIX_JETTY_RESPONSE_BUFFER_SIZE, 24 * 1024);
// copy rest of the properties
Enumeration keys = props.keys();
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
index 7d63625..aa410c1 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
@@ -306,6 +306,9 @@
private void configureConnector(final Connector connector)
{
connector.setMaxIdleTime(this.config.getHttpTimeout());
+ connector.setHeaderBufferSize(this.config.getHeaderBufferSize());
+ connector.setRequestBufferSize(this.config.getRequestBufferSize());
+ connector.setResponseBufferSize(this.config.getResponseBufferSize());
connector.setHost(this.config.getHost());
connector.setStatsOn(this.config.isRegisterMBeans());
diff --git a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties
index af78f58..b9bb0a4 100644
--- a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -92,4 +92,16 @@
org.apache.felix.http.mbeans.name = Register MBeans
org.apache.felix.http.mbeans.description = Whether or not to use register \
- JMX MBeans from the servlet container (Jetty).
\ No newline at end of file
+ JMX MBeans from the servlet container (Jetty).
+
+org.apache.felix.http.jetty.headerBufferSize.name = Header Buffer Size
+org.apache.felix.http.jetty.headerBufferSize.description = Size of the \
+ buffer for request and response headers. Default is 16KB.
+
+org.apache.felix.http.jetty.requestBufferSize.name = Request Buffer Size
+org.apache.felix.http.jetty.requestBufferSize.description = Size of the \
+ buffer for requests not fitting the header buffer. Default is 8KB.
+
+org.apache.felix.http.jetty.responseBufferSize.name = Response Buffer Size
+org.apache.felix.http.jetty.responseBufferSize.description = Size of the \
+ buffer for responses. Default is 24KB.
diff --git a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml
index 8e308e8..ae31108 100644
--- a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml
+++ b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml
@@ -15,6 +15,9 @@
<AD id="org.apache.felix.https.truststore" type="String" name="%org.apache.felix.https.truststore.name" description="%org.apache.felix.https.truststore.description"/>
<AD id="org.apache.felix.https.truststore.password" type="String" name="%org.apache.felix.https.truststore.password.name" description="%org.apache.felix.https.truststore.password.description"/>
<AD id="org.apache.felix.https.clientcertificate" type="String" default="none" name="%org.apache.felix.https.clientcertificate.name" description="%org.apache.felix.https.clientcertificate.description">
+ <AD id="org.apache.felix.http.jetty.headerBufferSize" type="Integer" default="16384" name="%org.apache.felix.http.jetty.headerBufferSize.name" description="%org.apache.felix.http.jetty.headerBufferSize.description">
+ <AD id="org.apache.felix.http.jetty.requestBufferSize" type="Integer" default="8192" name="%org.apache.felix.http.jetty.requestBufferSize.name" description="%org.apache.felix.http.jetty.requestBufferSize.description">
+ <AD id="org.apache.felix.http.jetty.responseBufferSize" type="Integer" default="24576" name="%org.apache.felix.http.jetty.responseBufferSize.name" description="%org.apache.felix.http.jetty.responseBufferSize.description">
<Option value="none" label="%clientcertificate.none"/>
<Option value="wants" label="%clientcertificate.wants"/>
<Option value="needs" label="%clientcertificate.needs"/>