org.apache.http.impl.nio
Class DefaultClientIOEventDispatch

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

public class DefaultClientIOEventDispatch
extends java.lang.Object
implements IOEventDispatch

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

The following parameters can be used to customize the behavior of this class:

Since:
4.0

Field Summary
protected  ByteBufferAllocator allocator
           
protected  NHttpClientHandler handler
           
protected  HttpParams params
           
 
Constructor Summary
DefaultClientIOEventDispatch(NHttpClientHandler 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  NHttpClientIOTarget createConnection(IOSession session)
          Creates an instance of DefaultNHttpClientConnection based on the given IOSession.
protected  HttpResponseFactory createHttpResponseFactory()
          Creates an instance of DefaultHttpResponseFactory to be used by HTTP connections for creating HttpResponse 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 NHttpClientHandler handler

params

protected final HttpParams params
Constructor Detail

DefaultClientIOEventDispatch

public DefaultClientIOEventDispatch(NHttpClientHandler 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 client 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.

createHttpResponseFactory

protected HttpResponseFactory createHttpResponseFactory()
Creates an instance of DefaultHttpResponseFactory to be used by HTTP connections for creating HttpResponse objects.

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

Returns:
HTTP response factory.

createConnection

protected NHttpClientIOTarget createConnection(IOSession session)
Creates an instance of DefaultNHttpClientConnection based on the given IOSession.

This method can be overridden in a super class in order to provide a different implementation of the NHttpClientIOTarget 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-2011 The Apache Software Foundation. All Rights Reserved.