com.sun.grizzly.http
Interface ProcessorTask

All Superinterfaces:
Callable, Runnable, Task
All Known Implementing Classes:
DefaultProcessorTask, SSLAsyncProcessorTask, SSLDefaultProcessorTask

public interface ProcessorTask
extends Task

Process HTTP request.

Author:
Jean-Francois Arcand

Field Summary
 
Fields inherited from interface com.sun.grizzly.http.Task
ACCEPT_TASK, PROCESSOR_TASK, READ_TASK
 
Method Summary
 int getBufferSize()
          Return the request input buffer size
 boolean getDropConnection()
          Is the keep-alive mechanism enabled or disabled.
 Interceptor getHandler()
          Get the Interceptor used by this instance.
 InputStream getInputStream()
          Get the InputStream associated with HTTP connection
 int getMaxPostSize()
          Return the maximum size of a POST which will be buffered in SSL mode.
 String getRequestURI()
          Return the request URI.
 Socket getSocket()
          Return the current Socket used by this instance
 long getWorkerThreadID()
          Return the current WorkerThread ID associated with this instance.
 void initialize()
          Initialize the stream and the buffer used to parse the request.
 void invokeAdapter()
          Invoke the Adapter, which usualy invoke the Servlet Container.
 boolean isError()
          Has an error occured duing the HTTP parsing?
 boolean isKeepAlive()
          Return true if the connection header was keep-alive.
 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.
 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 setBufferSize(int requestBufferSize)
          Set the request input buffer size
 void setDropConnection(boolean dropConnection)
          Enable or disable the keep-alive mechanism.
 void setHandler(Interceptor handler)
          Set the Interceptor used by this instance.
 void setInputStream(InputStream inputStream)
          Set the InputStream associated with HTTP connection
 void setMaxHttpHeaderSize(int maxHttpHeaderSize)
           
 void setMaxPostSize(int mps)
          Set the maximum size of a POST which will be buffered in SSL mode.
 void setSocket(Socket socket)
          Set the socket associated with this HTTP connection.
 void setTimeout(int timeouts)
          Set the upload timeout.
 void terminateProcess()
          Notify the TaskListener that the request has been fully processed.
 
Methods inherited from interface com.sun.grizzly.http.Task
addTaskListener, cancelTask, clearTaskListeners, doTask, execute, getKeepAliveStats, getPipeline, getRecycle, getRequestGroupInfo, getSelectionKey, getSelectorThread, getTaskListeners, getType, isMonitoringEnabled, recycle, removeTaskListener, setPipeline, setRecycle, setSelectionKey, setSelectorThread
 
Methods inherited from interface java.lang.Runnable
run
 
Methods inherited from interface java.util.concurrent.Callable
call
 

Method Detail

initialize

void initialize()
Initialize the stream and the buffer used to parse the request.


getBufferSize

int getBufferSize()
Return the request input buffer size


getDropConnection

boolean getDropConnection()
Is the keep-alive mechanism enabled or disabled.


getMaxPostSize

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


getSocket

Socket getSocket()
Return the current Socket used by this instance

Returns:
socket the current Socket used by this instance

invokeAdapter

void invokeAdapter()
Invoke the Adapter, which usualy invoke the Servlet Container.


parseRequest

void parseRequest()
                  throws Exception
Parse the request line and the http header.

Throws:
Exception

parseRequest

boolean parseRequest(InputStream input,
                     OutputStream output,
                     boolean keptAlive)
                     throws Exception
Parse the request line and the http header.

Parameters:
input - the InputStream to read bytes
output - the OutputStream to write bytes
Returns:
true if the parsing was successful.
Throws:
Exception

postProcess

void postProcess()
                 throws Exception
Post process the http request, after the response has been commited.

Throws:
Exception

postProcess

void postProcess(InputStream input,
                 OutputStream output)
                 throws Exception
Post process the http request, after the response has been commited.

Throws:
Exception

postResponse

void postResponse()
                  throws Exception
Prepare and post the response.

Parameters:
input - the InputStream to read bytes
output - the OutputStream to write bytes
Throws:
Exception

preProcess

void preProcess()
                throws Exception
Pre process the request by decoding the request line and the header.

Throws:
Exception

preProcess

void preProcess(InputStream input,
                OutputStream output)
                throws Exception
Pre process the request by decoding the request line and the header.

Parameters:
input - the InputStream to read bytes
output - the OutputStream to write bytes
Throws:
Exception

process

boolean process(InputStream input,
                OutputStream output)
                throws Exception
Process pipelined HTTP requests using the specified input and output streams.

Parameters:
input - stream from which the HTTP requests will be read
output - stream which will be used to output the HTTP responses
Returns:
true is an error occured.
Throws:
Exception - error during an I/O operation

setBufferSize

void setBufferSize(int requestBufferSize)
Set the request input buffer size


setDropConnection

void setDropConnection(boolean dropConnection)
Enable or disable the keep-alive mechanism. Setting this value to false will automatically add the following header to the response ' Connection: close '


setHandler

void setHandler(Interceptor handler)
Set the Interceptor used by this instance.


getHandler

Interceptor getHandler()
Get the Interceptor used by this instance.


setMaxHttpHeaderSize

void setMaxHttpHeaderSize(int maxHttpHeaderSize)

setMaxPostSize

void setMaxPostSize(int mps)
Set the maximum size of a POST which will be buffered in SSL mode.


setSocket

void setSocket(Socket socket)
Set the socket associated with this HTTP connection.


setInputStream

void setInputStream(InputStream inputStream)
Set the InputStream associated with HTTP connection


getInputStream

InputStream getInputStream()
Get the InputStream associated with HTTP connection


setTimeout

void setTimeout(int timeouts)
Set the upload timeout.


terminateProcess

void terminateProcess()
Notify the TaskListener that the request has been fully processed.


getRequestURI

String getRequestURI()
Return the request URI.


getWorkerThreadID

long getWorkerThreadID()
Return the current WorkerThread ID associated with this instance.


isKeepAlive

boolean isKeepAlive()
Return true if the connection header was keep-alive.


isError

boolean isError()
Has an error occured duing the HTTP parsing?



Copyright © 2011 SUN Microsystems. All Rights Reserved.