Author: rjung
Date: Wed Jan 27 09:16:03 2016
New Revision: 1726972
URL: http://svn.apache.org/viewvc?rev=1726972&view=rev
Log:
Add configuration option <code>ajpFlush</code>
for the AJP connectors to disable the sending
of AJP flush packets.
Modified:
tomcat/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml
tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
tomcat/trunk/webapps/docs/changelog.xml
tomcat/trunk/webapps/docs/config/ajp.xml
Modified: tomcat/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml?rev=1726972&r1=1726971&r2=1726972&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml Wed
Jan 27 09:16:03 2016
@@ -40,6 +40,10 @@
description="The IP address on which to bind"
type="java.lang.String"/>
+ <attribute name="ajpFlush"
+ description="Send AJP flush package for each explicit flush"
+ type="boolean"/>
+
<attribute name="allowTrace"
description="Allow disabling TRACE method"
type="boolean"/>
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java?rev=1726972&r1=1726971&r2=1726972&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java Wed Jan 27
09:16:03 2016
@@ -86,6 +86,20 @@ public abstract class AbstractAjpProtoco
// ------------------------------------------ managed in the
ProtocolHandler
/**
+ * Ignore explicit flush?
+ * An explicit flush will send a zero byte AJP13 SEND_BODY_CHUNK
+ * package. AJP does flush at the and of the response, so if
+ * it is not important, that the packets get streamed up to
+ * the client, do not use explicit flush.
+ */
+ protected boolean useAJPFlush = true;
+ public boolean getAjpFlush() { return useAJPFlush; }
+ public void setAjpFlush(boolean useAJPFlush) {
+ this.useAJPFlush = useAJPFlush;
+ }
+
+
+ /**
* Should authentication be done in the native web server layer,
* or in the Servlet container ?
*/
@@ -160,6 +174,7 @@ public abstract class AbstractAjpProtoco
protected Processor createProcessor() {
AjpProcessor processor = new AjpProcessor(getPacketSize(),
getEndpoint());
processor.setAdapter(getAdapter());
+ processor.setAjpFlush(getAjpFlush());
processor.setTomcatAuthentication(getTomcatAuthentication());
processor.setTomcatAuthorization(getTomcatAuthorization());
processor.setRequiredSecret(requiredSecret);
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1726972&r1=1726971&r2=1726972&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Wed Jan 27
09:16:03 2016
@@ -282,6 +282,20 @@ public class AjpProcessor extends Abstra
/**
+ * Ignore explicit flush?
+ * An explicit flush will send a zero byte AJP13 SEND_BODY_CHUNK
+ * package. AJP does flush at the and of the response, so if
+ * it is not important, that the packets get streamed up to
+ * the client, do not use explicit flush.
+ */
+ protected boolean ajpFlush = true;
+ public boolean getAjpFlush() { return ajpFlush; }
+ public void setAjpFlush(boolean ajpFlush) {
+ this.ajpFlush = ajpFlush;
+ }
+
+
+ /**
* The number of milliseconds Tomcat will wait for a subsequent request
* before closing the connection. The default is -1 which is an infinite
* timeout.
@@ -1380,8 +1394,10 @@ public class AjpProcessor extends Abstra
// non-blocking writes.
// TODO Validate the assertion above
if (!finished) {
- // Send the flush message
- socketWrapper.write(true, flushMessageArray, 0,
flushMessageArray.length);
+ if (ajpFlush) {
+ // Send the flush message
+ socketWrapper.write(true, flushMessageArray, 0,
flushMessageArray.length);
+ }
socketWrapper.flush(true);
}
}
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1726972&r1=1726971&r2=1726972&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed Jan 27 09:16:03 2016
@@ -54,6 +54,14 @@
</add>
</changelog>
</subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <add>
+ New configuration option <code>ajpFlush</code> for the AJP connectors
+ to disable the sending of AJP flush packets. (rjung)
+ </add>
+ </changelog>
+ </subsection>
<subsection name="Catalina">
<changelog>
<fix>
Modified: tomcat/trunk/webapps/docs/config/ajp.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/ajp.xml?rev=1726972&r1=1726971&r2=1726972&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/ajp.xml (original)
+++ tomcat/trunk/webapps/docs/config/ajp.xml Wed Jan 27 09:16:03 2016
@@ -74,6 +74,18 @@
<attributes>
+ <attribute name="ajpFlush" required="false">
+ <p>A boolean value which can be used to enable or disable sending
+ AJP flush messages to the fronting proxy whenever an explicit
+ flush happens. The default value is <code>true</code>.<br/>
+ An AJP flush message is a SEND_BODY_CHUNK packet with no body content.
+ Proxy implementations like mod_jk or mod_proxy_ajp will flush the
+ data buffered in the web server to the client when they receive
+ such a packet. Setting this to <code>false</code> can reduce
+ AJP packet traffic but might delay sending packets to the client.
+ At the end of the response, AJP does always flush to the client.</p>
+ </attribute>
+
<attribute name="allowTrace" required="false">
<p>A boolean value which can be used to enable or disable the TRACE
HTTP method. If not specified, this attribute is set to false.</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]