|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.enterprise.web.connector.grizzly.TaskBase
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask
public class DefaultProcessorTask
Process HTTP request. This class is based on
org.apache.coyote.http11.Http11Processor
| Field Summary | |
|---|---|
protected Adapter |
adapter
Associated adapter. |
protected boolean |
asyncExecution
Is asynchronous mode enabled? |
protected AsyncHandler |
asyncHandler
When the asynchronous mode is enabled, the execution of this object will be delegated to the AsyncHandler |
protected boolean |
bufferResponse
Buffer the response until the buffer is full. |
protected String[] |
compressableMimeTypes
List of MIMES which could be gzipped |
protected int |
compressionLevel
Allowed compression level. |
protected int |
compressionMinSize
Minimum contentsize to make compression. |
protected boolean |
connectionHeaderValueSet
Connection: value |
protected boolean |
contentDelimitation
Content delimitator for the request (if false, the connection will be closed at the end of the request). |
protected String |
defaultResponseType
The default response-type |
protected boolean |
disableUploadTimeout
Flag to disable setting a different time-out on uploads. |
protected boolean |
dropConnection
Allow client of this class to force connection closing. |
protected boolean |
error
Error flag. |
protected String |
forcedRequestType
The forced request-type |
protected Handler |
handler
The handler used by this Task to manipulate the request. |
protected boolean |
hasRequestInfoRegistered
Has the request associated with this ProcessorTask been
registered with the RequestGroupInfo |
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 InternalInputBuffer |
inputBuffer
Input. |
protected boolean |
keepAlive
Keep-alive. |
protected int |
keepAliveLeft
The current keep-alive count left 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 |
maxHttpHeaderSize
Default HTTP header buffer size. |
protected int |
maxKeepAliveRequests
Max keep-alive request before timing out. |
protected int |
maxPostSize
Max post size. |
protected String[] |
noCompressionUserAgents
List of user agents to not use gzip with |
protected ObjectName |
oname
ObjectName under which this ProcessorTask will be
JMX-registered if monitoring has been turned on |
protected InternalOutputBuffer |
outputBuffer
Output. |
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 int |
requestBufferSize
The input request buffer size. |
protected static int |
requestCount
The number of requests ProcessorTask has proceeded. |
protected RequestInfo |
requestInfo
The code>RequestInfo used to gather stats. |
protected Response |
response
Response object. |
protected String[] |
restrictedUserAgents
List of restricted user agents. |
protected Socket |
socket
Socket associated with the current connection. |
protected SSLSupport |
sslSupport
SSL information. |
protected boolean |
started
State flag. |
protected TaskContext |
taskContext
The taskContext associated with this object. |
protected TaskEvent<TaskContext> |
taskEvent
The TaskEvent associated with this task. |
protected int |
uploadTimeout
Maximum timeout on uploads. |
| Fields inherited from class com.sun.enterprise.web.connector.grizzly.TaskBase |
|---|
key, listeners, pipeline, recycle, selectorThread, type |
| Fields inherited from interface com.sun.enterprise.web.connector.grizzly.Task |
|---|
ACCEPT_TASK, PROCESSOR_TASK, READ_TASK |
| Constructor Summary | |
|---|---|
DefaultProcessorTask()
|
|
DefaultProcessorTask(boolean init)
|
|
DefaultProcessorTask(boolean init,
boolean bufferResponse)
|
|
| 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 compressable 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 void |
configPreProcess()
Prepare this object before parsing the request. |
protected boolean |
doProcess()
Process an HTTP request using a non blocking socket |
protected boolean |
doProcess(InputStream input,
OutputStream output)
Process an HTTP request using a non blocking socket |
void |
doTask()
Execute the HTTP request by parsing the header/body, and then by delegating the process to the Catalina container. |
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 restricted user agents. |
String[] |
findNoCompressionUserAgents()
Return the list of no compression user agents. |
String[] |
findRestrictedUserAgents()
Return the list of restricted user agents. |
Adapter |
getAdapter()
Get the associated adapter. |
AsyncHandler |
getAsyncHandler()
Return the AsyncHandler used when asynchronous execution is
enabled. |
int |
getBufferSize()
Return the request input buffer size |
String |
getCompression()
Return compression level. |
int |
getCompressionMinSize()
|
String |
getDefaultResponseType()
Return the default response type used |
boolean |
getDisableUploadTimeout()
Get the flag that controls upload time-outs. |
boolean |
getDropConnection()
Is the keep-alive mechanism enabled or disabled. |
String |
getForcedRequestType()
Return the default request type used |
Handler |
getHandler()
Return the Handler used by this instance. |
int |
getMaxHttpHeaderSize()
|
int |
getMaxPostSize()
Return the maximum size of a POST which will be buffered in SSL mode. |
Request |
getRequest()
Return the internal Request object. |
String |
getRequestURI()
Get the request URI associated with this processor. |
Socket |
getSocket()
Return the current Socket used by this instance |
SSLSupport |
getSSLSupport()
Return the SSLSupport object used by this instance. |
int |
getTimeout()
Get the upload timeout. |
long |
getWorkerThreadID()
Return the current WorkerThread ID associated with this instance. |
void |
initialize()
Initialize the stream and the buffer used to parse the request. |
protected void |
initializeFilters()
Initialize standard input and output filters. |
void |
invokeAdapter()
Invoke the Adapter, which usualy invoke the Servlet
Container. |
boolean |
isAsyncExecutionEnabled()
Is asynchronous execution enabled? |
boolean |
isError()
Has an error occured duing the HTTP parsing? |
boolean |
isKeepAlive()
Return true if the connection header was keep-alive. |
void |
parseHost(MessageBytes valueMB)
Parse host. |
void |
parseRequest()
Parse the request line and the http header. |
boolean |
parseRequest(InputStream input,
OutputStream output,
boolean keptAlive)
Parse the request line and the http header. |
void |
postProcess()
Post process the http request, after the response has been commited. |
void |
postProcess(InputStream input,
OutputStream output)
Post process the http request, after the response has been commited. |
void |
postResponse()
Prepare and post the response. |
protected void |
prepareRequest()
After reading the request headers, we have to setup the request filters. |
protected void |
prepareResponse()
When committing the response, we have to validate the set of headers, as well as setup the response filters. |
void |
preProcess()
Pre process the request by decoding the request line and the header. |
void |
preProcess(InputStream input,
OutputStream output)
Pre process the request by decoding the request line and the header. |
boolean |
process(InputStream input,
OutputStream output)
Process pipelined HTTP requests using the specified input and output streams. |
void |
recycle()
Recyle this object. |
void |
setAdapter(Adapter adapter)
Set the associated adapter. |
void |
setAsyncHandler(AsyncHandler asyncHandler)
Set the AsyncHandler used when asynchronous execution is
enabled. |
void |
setBufferSize(int requestBufferSize)
Set the request input buffer size |
void |
setCompressableMimeType(String[] compressableMimeTypes)
Set compressable 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 |
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 compressable 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)
|
void |
setConnectionHeaderValueSet(boolean connectionHeaderValueSet)
|
void |
setDefaultResponseType(String defaultResponseType)
Set the default response type used. |
void |
setDisableUploadTimeout(boolean isDisabled)
Set the flag to control upload time-outs. |
void |
setDropConnection(boolean dropConnection)
Enable or disable the keep-alive mechanism. |
void |
setEnableAsyncExecution(boolean asyncExecution)
Enable/disable asynchronous execution of this object. |
void |
setError(boolean error)
|
void |
setForcedRequestType(String forcedRequestType)
Sets the forced request type, which is forced onto requests that do not already specify any MIME type. |
void |
setForceKeepAlive(boolean forceKeepAlive)
Force keep-alive no mather what the client support. |
void |
setHandler(Handler handler)
Set the Handler used by this class. |
void |
setMaxHttpHeaderSize(int maxHttpHeaderSize)
|
void |
setMaxPostSize(int mps)
Set the maximum size of a POST which will be buffered in SSL mode. |
void |
setNoCompressionUserAgents(String[] 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 |
setRestrictedUserAgents(String[] 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 |
setSocket(Socket socket)
Set the socket associated with this HTTP connection. |
void |
setSSLSupport(SSLSupport sslSupport)
Set the SSLSupport object used by this instance. |
void |
setTimeout(int uploadTimeout)
Set the upload timeout. |
protected boolean |
statusDropsConnection(int status)
Determine if we must drop the connection because of the HTTP status code. |
void |
taskEvent(TaskEvent event)
This method is invoked when a WorkerThread starts
processing a Task object. |
void |
terminateProcess()
Notify the TaskListener that the request has been
fully processed. |
| Methods inherited from class com.sun.enterprise.web.connector.grizzly.TaskBase |
|---|
addTaskListener, call, cancelTask, clearTaskListeners, execute, fireTaskEvent, getKeepAliveStats, getPipeline, getRecycle, getRequestGroupInfo, getSelectionKey, getSelectorThread, getTaskListeners, getType, isMonitoringEnabled, removeTaskListener, run, setPipeline, setRecycle, setSelectionKey, setSelectorThread |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.enterprise.web.connector.grizzly.Task |
|---|
addTaskListener, cancelTask, clearTaskListeners, execute, getKeepAliveStats, getPipeline, getRecycle, getRequestGroupInfo, getSelectionKey, getSelectorThread, getTaskListeners, getType, isMonitoringEnabled, removeTaskListener, setPipeline, setRecycle, setSelectionKey, setSelectorThread |
| Methods inherited from interface java.lang.Runnable |
|---|
run |
| Methods inherited from interface java.util.concurrent.Callable |
|---|
call |
| Field Detail |
|---|
protected Adapter adapter
protected Request request
protected Response response
protected InternalInputBuffer inputBuffer
protected InternalOutputBuffer outputBuffer
protected boolean started
protected boolean error
protected boolean keepAlive
protected boolean connectionHeaderValueSet
protected boolean http11
protected boolean http09
protected boolean contentDelimitation
protected SSLSupport sslSupport
protected Socket socket
protected String remoteAddr
protected String remoteHost
protected String localName
protected int localPort
protected int remotePort
protected String localAddr
protected int uploadTimeout
protected int maxPostSize
protected char[] hostNameC
protected TaskContext taskContext
taskContext associated with this object. The
taskContext contains information about the current
connection.
protected TaskEvent<TaskContext> taskEvent
TaskEvent associated with this task.
protected boolean hasRequestInfoRegistered
ProcessorTask been
registered with the RequestGroupInfo
protected int maxHttpHeaderSize
protected static int requestCount
ProcessorTask has proceeded.
protected int requestBufferSize
protected ObjectName oname
ProcessorTask will be
JMX-registered if monitoring has been turned on
protected boolean dropConnection
protected int keepAliveLeft
protected Handler handler
Task to manipulate the request.
protected String defaultResponseType
protected String forcedRequestType
protected boolean asyncExecution
protected RequestInfo requestInfo
protected AsyncHandler asyncHandler
AsyncHandler
protected int maxKeepAliveRequests
protected String[] noCompressionUserAgents
protected String[] compressableMimeTypes
protected int compressionLevel
protected int compressionMinSize
protected String[] restrictedUserAgents
protected boolean bufferResponse
protected boolean disableUploadTimeout
| Constructor Detail |
|---|
public DefaultProcessorTask()
public DefaultProcessorTask(boolean init)
public DefaultProcessorTask(boolean init,
boolean bufferResponse)
| Method Detail |
|---|
public void initialize()
initialize in interface ProcessorTask
public void doTask()
throws IOException
doTask in interface TaskIOExceptionpublic void taskEvent(TaskEvent event)
TaskListenerWorkerThread starts
processing a Task object.
taskEvent in interface TaskListenertaskEvent in class TaskBase
public void preProcess()
throws Exception
preProcess in interface ProcessorTaskException
public void preProcess(InputStream input,
OutputStream output)
throws Exception
preProcess in interface ProcessorTaskinput - the InputStream to read bytesoutput - the OutputStream to write bytes
Exception
protected void configPreProcess()
throws Exception
Exception
protected boolean doProcess()
throws Exception
socket
Exception
protected boolean doProcess(InputStream input,
OutputStream output)
throws Exception
socket
input - the InputStream to read bytesoutput - the OutputStream to write bytes
Exception
public void postResponse()
throws Exception
postResponse in interface ProcessorTaskinput - the InputStream to read bytesoutput - the OutputStream to write bytes
Exceptionpublic void invokeAdapter()
Adapter, which usualy invoke the Servlet
Container.
invokeAdapter in interface ProcessorTask
public void parseRequest()
throws Exception
parseRequest in interface ProcessorTaskException
public boolean parseRequest(InputStream input,
OutputStream output,
boolean keptAlive)
throws Exception
parseRequest in interface ProcessorTaskinput - the InputStream to read bytesoutput - the OutputStream to write bytes
Exception
public void postProcess()
throws Exception
postProcess in interface ProcessorTaskException
public void postProcess(InputStream input,
OutputStream output)
throws Exception
postProcess in interface ProcessorTaskExceptionpublic void terminateProcess()
TaskListener that the request has been
fully processed.
terminateProcess in interface ProcessorTask
public boolean process(InputStream input,
OutputStream output)
throws Exception
process in interface ProcessorTaskprocess in interface Processorinput - stream from which the HTTP requests will be readoutput - stream which will be used to output the HTTP
responses
Exception - error during an I/O operationpublic String getRequestURI()
getRequestURI in interface ProcessorTask
public void action(ActionCode actionCode,
Object param)
action in interface ActionHookactionCode - Type of the actionparam - Action parameterpublic void setAdapter(Adapter adapter)
setAdapter in interface Processoradapter - the new adapterpublic Adapter getAdapter()
getAdapter in interface Processorprotected void prepareRequest()
public void parseHost(MessageBytes valueMB)
protected void prepareResponse()
protected void initializeFilters()
protected boolean addInputFilter(InputFilter[] inputFilters,
String encodingName)
protected int findBytes(ByteChunk bc,
byte[] b)
protected boolean statusDropsConnection(int status)
protected void addFilter(String className)
className - class name of the filterpublic void setMaxPostSize(int mps)
setMaxPostSize in interface ProcessorTaskpublic int getMaxPostSize()
getMaxPostSize in interface ProcessorTaskpublic void setSocket(Socket socket)
setSocket in interface ProcessorTaskpublic void setTimeout(int uploadTimeout)
setTimeout in interface ProcessorTaskpublic int getTimeout()
public int getMaxHttpHeaderSize()
public void setMaxHttpHeaderSize(int maxHttpHeaderSize)
setMaxHttpHeaderSize in interface ProcessorTaskpublic void setBufferSize(int requestBufferSize)
setBufferSize in interface ProcessorTaskpublic int getBufferSize()
getBufferSize in interface ProcessorTaskpublic Socket getSocket()
Socket used by this instance
getSocket in interface ProcessorTaskgetSocket in class TaskBaseSocket used by this instancepublic void setDropConnection(boolean dropConnection)
false will automatically add the following header to the
response ' Connection: close '
setDropConnection in interface ProcessorTaskpublic boolean getDropConnection()
getDropConnection in interface ProcessorTaskpublic void setHandler(Handler handler)
Handler used by this class.
setHandler in interface ProcessorTaskpublic Handler getHandler()
Handler used by this instance.
getHandler in interface ProcessorTaskpublic void setDefaultResponseType(String defaultResponseType)
public String getDefaultResponseType()
public void setForcedRequestType(String forcedRequestType)
public String getForcedRequestType()
public void setEnableAsyncExecution(boolean asyncExecution)
public boolean isAsyncExecutionEnabled()
public void setAsyncHandler(AsyncHandler asyncHandler)
AsyncHandler used when asynchronous execution is
enabled.
public AsyncHandler getAsyncHandler()
AsyncHandler used when asynchronous execution is
enabled.
public Request getRequest()
Request object.
public void recycle()
recycle in interface Taskrecycle in class TaskBasepublic String getCompression()
public void setCompression(String compression)
public void addNoCompressionUserAgent(String userAgent)
userAgent - user-agent stringpublic void setNoCompressionUserAgents(String[] noCompressionUserAgents)
public String[] findNoCompressionUserAgents()
public void addCompressableMimeType(String mimeType)
mimeType - mime-type stringpublic void setCompressableMimeTypes(String[] compressableMimeTypes)
public void setCompressableMimeTypes(String compressableMimeTypes)
public void setCompressableMimeType(String[] compressableMimeTypes)
public String[] findCompressableMimeTypes()
public int getCompressionMinSize()
public void setCompressionMinSize(int compressionMinSize)
public void addRestrictedUserAgent(String userAgent)
userAgent - user-agent stringpublic void setRestrictedUserAgents(String[] restrictedUserAgents)
public String[] findRestrictedUserAgents()
public SSLSupport getSSLSupport()
public void setSSLSupport(SSLSupport sslSupport)
public long getWorkerThreadID()
getWorkerThreadID in interface ProcessorTaskpublic boolean isKeepAlive()
ProcessorTask
isKeepAlive in interface ProcessorTaskpublic void setForceKeepAlive(boolean forceKeepAlive)
public void setConnectionHeaderValueSet(boolean connectionHeaderValueSet)
public boolean isError()
ProcessorTask
isError in interface ProcessorTaskpublic void setError(boolean error)
public void setDisableUploadTimeout(boolean isDisabled)
public boolean getDisableUploadTimeout()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||