simple.http.load
Class Process

java.lang.Object
  extended by simple.http.serve.Component
      extended by simple.http.load.Service
          extended by simple.http.load.Process
All Implemented Interfaces:
Resource

public abstract class Process
extends Service

The Process can be used to exploit the asynchronous ability of the simple.http framework. This enables the Service to process the HTTP transaction in a separate thread. This will allow the subclass to implement the process method. This method will be called from an asynchronous thread, so it allows the Resource to continue processing some job even when the HTTP response has been sent and committed. Further requests on the same HTTP pipeline can be processed while this is still active processing some task.

A HTTP pipeline contains many HTTP requests so when one is taken from the pipeline and handed to the Service the response must be waited for until the next request is handled, this is an ordering rule of the pipeline. However there may be need to continue with processing after the response has been dealt with. This Service implementation allows the subclass to take as long as it needs in handling the response and to continue processing after the response has been committed.

Author:
Niall Gallagher
See Also:
Response

Field Summary
 
Fields inherited from class simple.http.load.Service
engine
 
Fields inherited from class simple.http.serve.Component
context
 
Constructor Summary
Process(Context context)
          Constructor for the Process object is used so that the Context can be acquired.
 
Method Summary
 void handle(Request req, Response resp)
          This enables the Resource to be handled in a separate thread of execution.
 
Methods inherited from class simple.http.load.Service
prepare
 
Methods inherited from class simple.http.serve.Component
handle, handle, process, process, process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Process

public Process(Context context)
Constructor for the Process object is used so that the Context can be acquired. This enables the implementation to retrieve resources from the underlying file system. The Context is required for format of errors and directory listing. If the context is null the implementation will not generate HTTP error messages.

Parameters:
context - this is the Context that is used to generate error messages and acquire files with
Method Detail

handle

public void handle(Request req,
                   Response resp)
This enables the Resource to be handled in a separate thread of execution. This will instantiate a thread which can be used to process the subclass implementation of the process method. This will allow a task to be spawned within the server each time the implementation is requested. This is useful for tasks that need to perform additional work after the response has been delivered.

Specified by:
handle in interface Resource
Overrides:
handle in class Component
Parameters:
req - the HTTP request object representing the client
resp - the HTTP response used to deliver the message