simple.http.connect
Class SocketHandler

java.lang.Object
  extended by simple.http.connect.SocketHandler

public class SocketHandler
extends java.lang.Object

The SocketHandler object is used in conjunction with the Connection to dispatch Pipeline objects to a PipelineHandler for incoming TCP connections. The PipelineFactory object can be used to dispatch specialized Pipeline objects to the pipeline handler. This is useful when buffering is required for performance or when security measures are required.

Author:
Niall Gallagher

Constructor Summary
SocketHandler(PipelineHandler handler)
          This constructor creates a SocketHandler using a PipelineHandler object.
SocketHandler(PipelineHandler handler, PipelineFactory factory)
          This constructor creates a SocketHandler using a PipelineHandler object.
 
Method Summary
 void process(java.net.Socket sock)
          Once the Socket has been configured it can be used to create a Pipeline object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketHandler

public SocketHandler(PipelineHandler handler)
This constructor creates a SocketHandler using a PipelineHandler object. The handler will dispatch Pipeline objects to the given PipelineHandler once a socket is issued.

Parameters:
handler - the PipelineHandler used to process the connections

SocketHandler

public SocketHandler(PipelineHandler handler,
                     PipelineFactory factory)
This constructor creates a SocketHandler using a PipelineHandler object. The processor will dispatch Pipeline objects to the given PipelineHandler once a socket is issued.

The Pipeline's are created once a socket is given to the PipelineFactory. This enables the handler to attach special functionality to the pipelines dispatched to the PipelineHandler.

Parameters:
handler - the PipelineHandler used to process the connections
factory - this is the factory for implementations of the Pipeline object
Method Detail

process

public void process(java.net.Socket sock)
             throws java.io.IOException,
                    java.lang.InterruptedException
Once the Socket has been configured it can be used to create a Pipeline object. This object is then given to the PipelineHandler so that the connection can be processed and given to the ProtocolHandler so the HTTP request can be processed.

Parameters:
sock - this is the connected socket that will be used to create the Pipeline
Throws:
java.io.IOException - thrown if the Socket experiences an error
java.lang.InterruptedException - thrown if the thread has been interrupted before being used to hand over the Pipeline to the PipelineHandler