Tomcat 6 Default Buffer Size

Is there a way to set the default buffer size for JSP in Tomcat? I know that I can install them on every page, but I hope that somewhere there is a global option.

+3
source share
2 answers

Short answer: None.

Long answer: Perhaps with some hacks ...

  • You will need to create Tomcat yourself after editing this class: Jasper constants
  • ... or you can make a Perl pie and edit all of your JSPs all at once. First back up, as this edits the line:

For directives without a set of buffers:

/usr/bin/perl -pi -e 's|<%@ page|<%@ page buffer="new" |g' `find . -type f -name '*.jsp'`

For buffers already configured:

/usr/bin/perl -pi -e 's|buffer="old"|buffer="new"|g' `find . -type f -name '*.jsp'`

( , , / , regexp, )

: http://www.theserverside.com/discussions/thread.tss?thread_id=24768

+3

EDIT: - ,

() (jsp), jsp, . . (, 302), . , 500 . html (200), . , .

, . : , , ( 302) , 200- . , , , . taglib, taglib. :

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<% /* your processing instructions here */ 
   response.sendRedirect("somewhere.jsp") %>

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" 
%><%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"
 %><% /* your processing instructions here */ 
   response.sendRedirect("somewhere.jsp") %>

jsp :

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %><%-- 
--%><%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%><%--
--%><% /* your processing instructions here */ 
   response.sendRedirect("somewhere.jsp") %>

, , - , .

, .


, /

Tomcat http- bufferSize, socketBuffer nio - , . AJP- ( ajp, Apache/mod_jk).

, , , ...

EDIT: ( , , AJP:)

, ( tomcat 6.0.18) org.apache.catalina.connector.OutputBuffer org.apache.catalina.connector.Response. ( ):

/**
 * Set the Connector through which this Request was received.
 *
 * @param connector The new connector
 */
public void setConnector(Connector connector) {
    this.connector = connector;
    if("AJP/1.3".equals(connector.getProtocol())) {
        // default size to size of one ajp-packet
        outputBuffer = new OutputBuffer(8184);
    } else {
        outputBuffer = new OutputBuffer();
    }
    outputStream = new CoyoteOutputStream(outputBuffer);
    writer = new CoyoteWriter(outputBuffer);
}

, , . , , ... jsps? ?

tomcat, - tomcat, . ( tomcat )

, : (, , jsp, ), , jsps. , , , 10 ( ).

, ...

+2

All Articles