Apache Tomcat 7.0.4

org.apache.coyote.http11
Class AbstractHttp11Processor

java.lang.Object
  extended by org.apache.coyote.http11.AbstractHttp11Processor
All Implemented Interfaces:
ActionHook, Processor
Direct Known Subclasses:
Http11AprProcessor, Http11NioProcessor, Http11Processor

public abstract class AbstractHttp11Processor
extends Object
implements ActionHook, Processor


Field Summary
protected  Adapter adapter
          Associated adapter.
protected  AsyncStateMachine asyncStateMachine
          Track changes in state for async requests.
protected  String[] compressableMimeTypes
          List of MIMES which could be gzipped
protected  int compressionLevel
          Allowed compression level.
protected  int compressionMinSize
          Minimum content size to make compression.
protected  boolean contentDelimitation
          Content delimiter for the request (if false, the connection will be closed at the end of the request).
protected  boolean disableUploadTimeout
          Flag to disable setting a different time-out on uploads.
protected  boolean error
          Error flag.
protected  boolean expectation
          Is there an expectation ?
protected  char[] hostNameC
          Host name (used to avoid useless B2C conversion on the host name).
protected  boolean http09
          HTTP/0.9 flag.
protected  boolean http11
          HTTP/1.1 flag.
protected static boolean isSecurityEnabled
           
protected  boolean keepAlive
          Keep-alive.
protected  int keepAliveTimeout
          The number of seconds Tomcat will wait for a subsequent request before closing the connection.
protected  String localAddr
          The local Host address.
protected  String localName
          Local Host associated with the current connection.
protected  int localPort
          Local port to which the socket is connected
protected  int maxKeepAliveRequests
          Maximum number of Keep-Alive requests to honor.
protected  int maxSavePostSize
          Max saved post size.
protected  Pattern[] noCompressionUserAgents
          List of user agents to not use gzip with
protected  String remoteAddr
          Remote Address associated with the current connection.
protected  String remoteHost
          Remote Host associated with the current connection.
protected  int remotePort
          Remote port to which the socket is connected
protected  Request request
          Request object.
protected  Response response
          Response object.
protected  Pattern[] restrictedUserAgents
          List of restricted user agents.
protected  String server
          Allow a customized the server header for the tin-foil hat folks.
protected static StringManager sm
          The string manager for this package.
protected  int socketBuffer
          Socket buffering.
protected  int timeout
          Maximum timeout on uploads. 5 minutes as in Apache HTTPD server.
 
Constructor Summary
AbstractHttp11Processor()
           
 
Method Summary
 void action(ActionCode actionCode, Object param)
          Send an action to the connector.
 void addCompressableMimeType(String mimeType)
          Add a mime-type which will be compressible The mime-type String will be exactly matched in the response mime-type header .
protected  void addFilter(String className)
          Add input or output filter.
protected  boolean addInputFilter(InputFilter[] inputFilters, String encodingName)
          Add an input filter to the current request.
 void addNoCompressionUserAgent(String userAgent)
          Add user-agent for which gzip compression didn't works The user agent String given will be exactly matched to the user-agent header submitted by the client.
 void addRestrictedUserAgent(String userAgent)
          Add restricted user-agent (which will downgrade the connector to HTTP/1.0 mode).
protected  AbstractEndpoint.Handler.SocketState asyncPostProcess()
           
 void endRequest()
           
protected  int findBytes(ByteChunk bc, byte[] b)
          Specialized utility method: find a sequence of lower case bytes inside a ByteChunk.
 String[] findCompressableMimeTypes()
          Return the list of compressable mime-types.
 String[] findRestrictedUserAgents()
          Return the list of restricted user agents.
 Adapter getAdapter()
          Get the associated adapter.
 String getCompression()
          Return compression level.
 boolean getDisableUploadTimeout()
          Get the flag that controls upload time-outs.
abstract  Executor getExecutor()
           
protected abstract  AbstractInputBuffer getInputBuffer()
          Exposes input buffer to super class to allow better code re-use.
 int getKeepAliveTimeout()
          Return the number Keep-Alive timeout.
protected abstract  Log getLog()
           
 int getMaxKeepAliveRequests()
          Return the number of Keep-Alive requests that we will honor.
 int getMaxSavePostSize()
          Return the maximum size of a POST which will be buffered in SSL mode.
protected abstract  AbstractOutputBuffer getOutputBuffer()
          Exposes output buffer to super class to allow better code re-use.
 Request getRequest()
          Get the request associated with this processor.
 String getServer()
          Get the server header name.
 int getSocketBuffer()
          Get the socket buffer flag.
 int getTimeout()
          Get the upload timeout.
protected  void initializeFilters()
          Initialize standard input and output filters.
protected  boolean isAsync()
           
 void recycle()
           
protected abstract  void recycleInternal()
           
 void setAdapter(Adapter adapter)
          Set the associated adapter.
 void setCompressableMimeTypes(String compressableMimeTypes)
          Set compressable mime-type list List contains users agents separated by ',' : ie: "text/html,text/xml,text/plain"
 void setCompressableMimeTypes(String[] compressableMimeTypes)
          Set compressible mime-type list (this method is best when used with a large number of connectors, where it would be better to have all of them referenced a single array).
 void setCompression(String compression)
          Set compression level.
 void setCompressionMinSize(int compressionMinSize)
          Set Minimum size to trigger compression.
 void setDisableUploadTimeout(boolean isDisabled)
          Set the flag to control upload time-outs.
 void setKeepAliveTimeout(int timeout)
          Set the Keep-Alive timeout.
 void setMaxKeepAliveRequests(int mkar)
          Set the maximum number of Keep-Alive requests to honor.
 void setMaxSavePostSize(int msps)
          Set the maximum size of a POST which will be buffered in SSL mode.
 void setNoCompressionUserAgents(Pattern[] noCompressionUserAgents)
          Set no compression user agent list (this method is best when used with a large number of connectors, where it would be better to have all of them referenced a single array).
 void setNoCompressionUserAgents(String noCompressionUserAgents)
          Set no compression user agent list.
 void setRestrictedUserAgents(Pattern[] restrictedUserAgents)
          Set restricted user agent list (this method is best when used with a large number of connectors, where it would be better to have all of them referenced a single array).
 void setRestrictedUserAgents(String restrictedUserAgents)
          Set restricted user agent list (which will downgrade the connector to HTTP/1.0 mode).
 void setServer(String server)
          Set the server header name.
 void setSocketBuffer(int socketBuffer)
          Set the socket buffer flag.
 void setTimeout(int timeouts)
          Set the upload timeout.
protected  boolean statusDropsConnection(int status)
          Determine if we must drop the connection because of the HTTP status code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sm

protected static final StringManager sm
The string manager for this package.


isSecurityEnabled

protected static boolean isSecurityEnabled

adapter

protected Adapter adapter
Associated adapter.


request

protected Request request
Request object.


response

protected Response response
Response object.


error

protected boolean error
Error flag.


keepAlive

protected boolean keepAlive
Keep-alive.


http11

protected boolean http11
HTTP/1.1 flag.


http09

protected boolean http09
HTTP/0.9 flag.


contentDelimitation

protected boolean contentDelimitation
Content delimiter for the request (if false, the connection will be closed at the end of the request).


expectation

protected boolean expectation
Is there an expectation ?


restrictedUserAgents

protected Pattern[] restrictedUserAgents
List of restricted user agents.


maxKeepAliveRequests

protected int maxKeepAliveRequests
Maximum number of Keep-Alive requests to honor.


keepAliveTimeout

protected int keepAliveTimeout
The number of seconds Tomcat will wait for a subsequent request before closing the connection.


remoteAddr

protected String remoteAddr
Remote Address associated with the current connection.


remoteHost

protected String remoteHost
Remote Host associated with the current connection.


localName

protected String localName
Local Host associated with the current connection.


localPort

protected int localPort
Local port to which the socket is connected


remotePort

protected int remotePort
Remote port to which the socket is connected


localAddr

protected String localAddr
The local Host address.


timeout

protected int timeout
Maximum timeout on uploads. 5 minutes as in Apache HTTPD server.


disableUploadTimeout

protected boolean disableUploadTimeout
Flag to disable setting a different time-out on uploads.


compressionLevel

protected int compressionLevel
Allowed compression level.


compressionMinSize

protected int compressionMinSize
Minimum content size to make compression.


socketBuffer

protected int socketBuffer
Socket buffering.


maxSavePostSize

protected int maxSavePostSize
Max saved post size.


noCompressionUserAgents

protected Pattern[] noCompressionUserAgents
List of user agents to not use gzip with


compressableMimeTypes

protected String[] compressableMimeTypes
List of MIMES which could be gzipped


hostNameC

protected char[] hostNameC
Host name (used to avoid useless B2C conversion on the host name).


server

protected String server
Allow a customized the server header for the tin-foil hat folks.


asyncStateMachine

protected AsyncStateMachine asyncStateMachine
Track changes in state for async requests.

Constructor Detail

AbstractHttp11Processor

public AbstractHttp11Processor()
Method Detail

getLog

protected abstract Log getLog()

setCompression

public void setCompression(String compression)
Set compression level.


setCompressionMinSize

public void setCompressionMinSize(int compressionMinSize)
Set Minimum size to trigger compression.


addNoCompressionUserAgent

public void addNoCompressionUserAgent(String userAgent)
Add user-agent for which gzip compression didn't works The user agent String given will be exactly matched to the user-agent header submitted by the client.

Parameters:
userAgent - user-agent string

setNoCompressionUserAgents

public void setNoCompressionUserAgents(Pattern[] noCompressionUserAgents)
Set no compression user agent list (this method is best when used with a large number of connectors, where it would be better to have all of them referenced a single array).


setNoCompressionUserAgents

public void setNoCompressionUserAgents(String noCompressionUserAgents)
Set no compression user agent list. List contains users agents separated by ',' : ie: "gorilla,desesplorer,tigrus"


addCompressableMimeType

public void addCompressableMimeType(String mimeType)
Add a mime-type which will be compressible The mime-type String will be exactly matched in the response mime-type header .

Parameters:
mimeType - mime-type string

setCompressableMimeTypes

public void setCompressableMimeTypes(String[] compressableMimeTypes)
Set compressible mime-type list (this method is best when used with a large number of connectors, where it would be better to have all of them referenced a single array).


setCompressableMimeTypes

public void setCompressableMimeTypes(String compressableMimeTypes)
Set compressable mime-type list List contains users agents separated by ',' : ie: "text/html,text/xml,text/plain"


findCompressableMimeTypes

public String[] findCompressableMimeTypes()
Return the list of compressable mime-types.


getCompression

public String getCompression()
Return compression level.


addRestrictedUserAgent

public void addRestrictedUserAgent(String userAgent)
Add restricted user-agent (which will downgrade the connector to HTTP/1.0 mode). The user agent String given will be matched via regexp to the user-agent header submitted by the client.

Parameters:
userAgent - user-agent string

setRestrictedUserAgents

public void setRestrictedUserAgents(Pattern[] restrictedUserAgents)
Set restricted user agent list (this method is best when used with a large number of connectors, where it would be better to have all of them referenced a single array).


setRestrictedUserAgents

public void setRestrictedUserAgents(String restrictedUserAgents)
Set restricted user agent list (which will downgrade the connector to HTTP/1.0 mode). List contains users agents separated by ',' : ie: "gorilla,desesplorer,tigrus"


findRestrictedUserAgents

public String[] findRestrictedUserAgents()
Return the list of restricted user agents.


setMaxKeepAliveRequests

public void setMaxKeepAliveRequests(int mkar)
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.


getMaxKeepAliveRequests

public int getMaxKeepAliveRequests()
Return the number of Keep-Alive requests that we will honor.


setKeepAliveTimeout

public void setKeepAliveTimeout(int timeout)
Set the Keep-Alive timeout.


getKeepAliveTimeout

public int getKeepAliveTimeout()
Return the number Keep-Alive timeout.


setMaxSavePostSize

public void setMaxSavePostSize(int msps)
Set the maximum size of a POST which will be buffered in SSL mode.


getMaxSavePostSize

public int getMaxSavePostSize()
Return the maximum size of a POST which will be buffered in SSL mode.


setDisableUploadTimeout

public void setDisableUploadTimeout(boolean isDisabled)
Set the flag to control upload time-outs.


getDisableUploadTimeout

public boolean getDisableUploadTimeout()
Get the flag that controls upload time-outs.


setSocketBuffer

public void setSocketBuffer(int socketBuffer)
Set the socket buffer flag.


getSocketBuffer

public int getSocketBuffer()
Get the socket buffer flag.


setTimeout

public void setTimeout(int timeouts)
Set the upload timeout.


getTimeout

public int getTimeout()
Get the upload timeout.


setServer

public void setServer(String server)
Set the server header name.


getServer

public String getServer()
Get the server header name.


getRequest

public Request getRequest()
Get the request associated with this processor.

Returns:
The request

setAdapter

public void setAdapter(Adapter adapter)
Set the associated adapter.

Parameters:
adapter - the new adapter

getAdapter

public Adapter getAdapter()
Get the associated adapter.

Returns:
the associated adapter

findBytes

protected int findBytes(ByteChunk bc,
                        byte[] b)
Specialized utility method: find a sequence of lower case bytes inside a ByteChunk.


statusDropsConnection

protected boolean statusDropsConnection(int status)
Determine if we must drop the connection because of the HTTP status code. Use the same list of codes as Apache/httpd.


getInputBuffer

protected abstract AbstractInputBuffer getInputBuffer()
Exposes input buffer to super class to allow better code re-use.

Returns:
The input buffer used by the processor.

getOutputBuffer

protected abstract AbstractOutputBuffer getOutputBuffer()
Exposes output buffer to super class to allow better code re-use.

Returns:
The output buffer used by the processor.

initializeFilters

protected void initializeFilters()
Initialize standard input and output filters.


addFilter

protected void addFilter(String className)
Add input or output filter.

Parameters:
className - class name of the filter

addInputFilter

protected boolean addInputFilter(InputFilter[] inputFilters,
                                 String encodingName)
Add an input filter to the current request.

Returns:
false if the encoding was not found (which would mean it is unsupported)

action

public final void action(ActionCode actionCode,
                         Object param)
Send an action to the connector.

Specified by:
action in interface ActionHook
Parameters:
actionCode - Type of the action
param - Action parameter

endRequest

public void endRequest()

recycle

public final void recycle()

recycleInternal

protected abstract void recycleInternal()

getExecutor

public abstract Executor getExecutor()
Specified by:
getExecutor in interface Processor

isAsync

protected boolean isAsync()

asyncPostProcess

protected AbstractEndpoint.Handler.SocketState asyncPostProcess()

Apache Tomcat 7.0.4

Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.