org.apache.http.impl.nio
Class DefaultServerIOEventDispatch

java.lang.Object
  extended by org.apache.http.impl.nio.DefaultServerIOEventDispatch
All Implemented Interfaces:
IOEventDispatch

public class DefaultServerIOEventDispatch
extends Object
implements IOEventDispatch

Default implementation of IOEventDispatch interface for plain (unencrypted) server-side HTTP connections.

Since:
4.0
Version:
$Revision: 744535 $

Field Summary
protected  ByteBufferAllocator allocator
           
protected  NHttpServiceHandler handler
           
protected  HttpParams params
           
 
Constructor Summary
DefaultServerIOEventDispatch(NHttpServiceHandler handler, HttpParams params)
          Creates a new instance of this class to be used for dispatching I/O event notifications to the given protocol handler.
 
Method Summary
 void connected(IOSession session)
          Triggered after the given session has been just created.
protected  ByteBufferAllocator createByteBufferAllocator()
          Creates an instance of HeapByteBufferAllocator to be used by HTTP connections for allocating ByteBuffer objects.
protected  NHttpServerIOTarget createConnection(IOSession session)
          Creates an instance of DefaultNHttpServerConnection based on the given IOSession.
protected  HttpRequestFactory createHttpRequestFactory()
          Creates an instance of DefaultHttpRequestFactory to be used by HTTP connections for creating HttpRequest objects.
 void disconnected(IOSession session)
          Triggered when the given session has been terminated.
 void inputReady(IOSession session)
          Triggered when the given session has input pending.
 void outputReady(IOSession session)
          Triggered when the given session is ready for output.
 void timeout(IOSession session)
          Triggered when the given session as timed out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allocator

protected final ByteBufferAllocator allocator

handler

protected final NHttpServiceHandler handler

params

protected final HttpParams params
Constructor Detail

DefaultServerIOEventDispatch

public DefaultServerIOEventDispatch(NHttpServiceHandler handler,
                                    HttpParams params)
Creates a new instance of this class to be used for dispatching I/O event notifications to the given protocol handler.

Parameters:
handler - the server protocol handler.
params - HTTP parameters.
Method Detail

createByteBufferAllocator

protected ByteBufferAllocator createByteBufferAllocator()
Creates an instance of HeapByteBufferAllocator to be used by HTTP connections for allocating ByteBuffer objects.

This method can be overridden in a super class in order to provide a different implementation of the ByteBufferAllocator interface.

Returns:
byte buffer allocator.

createHttpRequestFactory

protected HttpRequestFactory createHttpRequestFactory()
Creates an instance of DefaultHttpRequestFactory to be used by HTTP connections for creating HttpRequest objects.

This method can be overridden in a super class in order to provide a different implementation of the HttpRequestFactory interface.

Returns:
HTTP request factory.

createConnection

protected NHttpServerIOTarget createConnection(IOSession session)
Creates an instance of DefaultNHttpServerConnection based on the given IOSession.

This method can be overridden in a super class in order to provide a different implementation of the NHttpServerIOTarget interface.

Parameters:
session - the underlying I/O session.
Returns:
newly created HTTP connection.

connected

public void connected(IOSession session)
Description copied from interface: IOEventDispatch
Triggered after the given session has been just created.

Specified by:
connected in interface IOEventDispatch
Parameters:
session - the I/O session.

disconnected

public void disconnected(IOSession session)
Description copied from interface: IOEventDispatch
Triggered when the given session has been terminated.

Specified by:
disconnected in interface IOEventDispatch
Parameters:
session - the I/O session.

inputReady

public void inputReady(IOSession session)
Description copied from interface: IOEventDispatch
Triggered when the given session has input pending.

Specified by:
inputReady in interface IOEventDispatch
Parameters:
session - the I/O session.

outputReady

public void outputReady(IOSession session)
Description copied from interface: IOEventDispatch
Triggered when the given session is ready for output.

Specified by:
outputReady in interface IOEventDispatch
Parameters:
session - the I/O session.

timeout

public void timeout(IOSession session)
Description copied from interface: IOEventDispatch
Triggered when the given session as timed out.

Specified by:
timeout in interface IOEventDispatch
Parameters:
session - the I/O session.


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.