protected static final StringManager sm =
StringManager.getManager(Constants.Package);
- protected static boolean isSecurityEnabled =
- org.apache.coyote.Constants.IS_SECURITY_ENABLED;
-
/*
* Tracks how many internal filters are in the filter library so they
* are skipped when looking for pluggable filters.
/**
- * Return the list of compressable mime-types.
- */
- public String[] findCompressableMimeTypes() {
- return (compressableMimeTypes);
- }
-
-
- /**
* Return compression level.
*/
public String getCompression() {
/**
- * Return the list of restricted user agents.
- */
- public String[] findRestrictedUserAgents() {
- String[] sarr = new String [restrictedUserAgents.length];
-
- for (int i = 0; i < restrictedUserAgents.length; i++)
- sarr[i] = restrictedUserAgents[i].toString();
-
- return (sarr);
- }
-
-
- /**
* Set the maximum number of Keep-Alive requests to honor.
* This is to safeguard from DoS attacks. Setting to a negative
* value disables the check.
/**
- * Add input or output filter.
- *
- * @param className class name of the filter
- */
- protected void addFilter(String className) {
- try {
- Class<?> clazz = Class.forName(className);
- Object obj = clazz.newInstance();
- if (obj instanceof InputFilter) {
- getInputBuffer().addFilter((InputFilter) obj);
- } else if (obj instanceof OutputFilter) {
- getOutputBuffer().addFilter((OutputFilter) obj);
- } else {
- getLog().warn(sm.getString("http11processor.filter.unknown",
- className));
- }
- } catch (Exception e) {
- getLog().error(sm.getString(
- "http11processor.filter.error", className), e);
- }
- }
-
-
- /**
* Add an input filter to the current request.
*
* @return false if the encoding was not found (which would mean it is
/**
- * Clear filters.
- */
- public void clearFilters() {
-
- filterLibrary = new InputFilter[0];
- lastActiveFilter = -1;
-
- }
-
-
- /**
* Add an input filter to the filter library.
*/
public void addActiveFilter(InputFilter filter) {
import org.apache.tomcat.util.buf.CharChunk;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.HttpMessages;
-import org.apache.tomcat.util.http.MimeHeaders;
import org.apache.tomcat.util.res.StringManager;
public abstract class AbstractOutputBuffer implements OutputBuffer{
/**
- * Headers of the associated request.
- */
- protected MimeHeaders headers;
-
-
- /**
* Committed flag.
*/
protected boolean committed;
/**
- * Clear filters.
- */
- public void clearFilters() {
-
- filterLibrary = new OutputFilter[0];
- lastActiveFilter = -1;
-
- }
-
-
- /**
* Add an output filter to the filter library.
*/
public void addActiveFilter(OutputFilter filter) {
/**
- * Send a header.
- *
- * @param name Header name
- * @param value Header value
- */
- public void sendHeader(ByteChunk name, ByteChunk value) {
-
- write(name);
- buf[pos++] = Constants.COLON;
- buf[pos++] = Constants.SP;
- write(value);
- buf[pos++] = Constants.CR;
- buf[pos++] = Constants.LF;
-
- }
-
-
- /**
- * Send a header.
- *
- * @param name Header name
- * @param value Header value
- */
- public void sendHeader(String name, String value) {
-
- write(name);
- buf[pos++] = Constants.COLON;
- buf[pos++] = Constants.SP;
- write(value);
- buf[pos++] = Constants.CR;
- buf[pos++] = Constants.LF;
-
- }
-
-
- /**
* End the header block.
*/
public void endHeaders() {
public static final int DEFAULT_CONNECTION_LINGER = -1;
public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;
- public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000;
- public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0;
public static final boolean DEFAULT_TCP_NO_DELAY = true;
/* Various constant "strings" */
- public static final byte[] CRLF_BYTES = ByteChunk.convertToBytes(CRLF);
- public static final byte[] COLON_BYTES = ByteChunk.convertToBytes(": ");
public static final String CONNECTION = "Connection";
public static final String CLOSE = "close";
public static final byte[] CLOSE_BYTES =
public class InternalAprOutputBuffer extends AbstractOutputBuffer {
- // -------------------------------------------------------------- Constants
-
-
// ----------------------------------------------------------- Constructors
-
/**
* Default constructor.
*/
- public InternalAprOutputBuffer(Response response) {
- this(response, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE);
- }
-
-
- /**
- * Alternate constructor.
- */
public InternalAprOutputBuffer(Response response, int headerBufferSize) {
this.response = response;
- headers = response.getMimeHeaders();
buf = new byte[headerBufferSize];
if (headerBufferSize < (8 * 1024)) {
/**
* Default constructor.
*/
- public InternalInputBuffer(Request request) {
- this(request, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE);
- }
-
-
- /**
- * Alternate constructor.
- */
public InternalInputBuffer(Request request, int headerBufferSize) {
this.request = request;
*/
public class InternalNioOutputBuffer extends AbstractOutputBuffer {
-
- // -------------------------------------------------------------- Constants
-
-
// ----------------------------------------------------------- Constructors
- /**
- * Default constructor.
- */
- public InternalNioOutputBuffer(Response response) {
- this(response, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE);
- }
-
/**
- * Alternate constructor.
+ * Default constructor.
*/
public InternalNioOutputBuffer(Response response, int headerBufferSize) {
this.response = response;
- headers = response.getMimeHeaders();
buf = new byte[headerBufferSize];
public class InternalOutputBuffer extends AbstractOutputBuffer
implements ByteChunk.ByteOutputChannel {
- // -------------------------------------------------------------- Constants
-
-
// ----------------------------------------------------------- Constructors
-
/**
* Default constructor.
*/
- public InternalOutputBuffer(Response response) {
- this(response, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE);
- }
-
-
- /**
- * Alternate constructor.
- */
public InternalOutputBuffer(Response response, int headerBufferSize) {
this.response = response;
-
- headers = response.getMimeHeaders();
buf = new byte[headerBufferSize];
}
- // ----------------------------------------------------- Instance Variables
-
-
- /**
- * Next buffer in the pipeline.
- */
- protected OutputBuffer buffer;
-
-
// --------------------------------------------------- OutputBuffer Methods
*/
@Override
public void setBuffer(OutputBuffer buffer) {
- this.buffer = buffer;
+ // NO-OP
}