org.apache.http.impl.nio
Class NHttpConnectionBase

java.lang.Object
  extended by org.apache.http.impl.nio.NHttpConnectionBase
All Implemented Interfaces:
org.apache.http.HttpConnection, org.apache.http.HttpInetConnection, IOControl, NHttpConnection, SessionBufferStatus
Direct Known Subclasses:
DefaultNHttpClientConnection, DefaultNHttpServerConnection

public class NHttpConnectionBase
extends java.lang.Object
implements NHttpConnection, org.apache.http.HttpInetConnection, SessionBufferStatus


Field Summary
protected  org.apache.http.impl.HttpConnectionMetricsImpl connMetrics
           
protected  ContentDecoder contentDecoder
           
protected  ContentEncoder contentEncoder
           
protected  org.apache.http.protocol.HttpContext context
           
protected  boolean hasBufferedInput
           
protected  boolean hasBufferedOutput
           
protected  SessionInputBufferImpl inbuf
           
protected  org.apache.http.entity.ContentLengthStrategy incomingContentStrategy
           
protected  org.apache.http.impl.io.HttpTransportMetricsImpl inTransportMetrics
           
protected  SessionOutputBufferImpl outbuf
           
protected  org.apache.http.entity.ContentLengthStrategy outgoingContentStrategy
           
protected  org.apache.http.impl.io.HttpTransportMetricsImpl outTransportMetrics
           
protected  org.apache.http.HttpRequest request
           
protected  org.apache.http.HttpResponse response
           
protected  IOSession session
           
protected  int status
           
 
Fields inherited from interface org.apache.http.nio.NHttpConnection
ACTIVE, CLOSED, CLOSING
 
Constructor Summary
NHttpConnectionBase(IOSession session, ByteBufferAllocator allocator, org.apache.http.params.HttpParams params)
           
 
Method Summary
protected  void assertNotClosed()
           
 void close()
           
 org.apache.http.protocol.HttpContext getContext()
          Returns an HTTP execution context associated with this connection.
 org.apache.http.HttpRequest getHttpRequest()
          Returns the current HTTP request if one is being received / transmitted.
 org.apache.http.HttpResponse getHttpResponse()
          Returns the current HTTP response if one is being received / transmitted.
 java.net.InetAddress getLocalAddress()
           
 int getLocalPort()
           
 org.apache.http.HttpConnectionMetrics getMetrics()
           
 java.net.InetAddress getRemoteAddress()
           
 int getRemotePort()
           
 int getSocketTimeout()
           
 int getStatus()
           
 boolean hasBufferedInput()
           
 boolean hasBufferedOutput()
           
 boolean isOpen()
           
 boolean isStale()
           
protected  org.apache.http.HttpEntity prepareDecoder(org.apache.http.HttpMessage message)
           
protected  void prepareEncoder(org.apache.http.HttpMessage message)
           
 void requestInput()
          Requests event notifications to be triggered when the underlying channel is ready for input oprtations.
 void requestOutput()
          Requests event notifications to be triggered when the underlying channel is ready for output oprtations.
 void setSocketTimeout(int timeout)
           
 void shutdown()
          Shuts down the underlying channel.
 void suspendInput()
          Suspends event notifications about the underlying channel being ready for input operations.
 void suspendOutput()
          Suspends event notifications about the underlying channel being ready for output operations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected final org.apache.http.protocol.HttpContext context

incomingContentStrategy

protected final org.apache.http.entity.ContentLengthStrategy incomingContentStrategy

outgoingContentStrategy

protected final org.apache.http.entity.ContentLengthStrategy outgoingContentStrategy

inbuf

protected final SessionInputBufferImpl inbuf

outbuf

protected final SessionOutputBufferImpl outbuf

inTransportMetrics

protected final org.apache.http.impl.io.HttpTransportMetricsImpl inTransportMetrics

outTransportMetrics

protected final org.apache.http.impl.io.HttpTransportMetricsImpl outTransportMetrics

connMetrics

protected final org.apache.http.impl.HttpConnectionMetricsImpl connMetrics

session

protected IOSession session

contentDecoder

protected volatile ContentDecoder contentDecoder

hasBufferedInput

protected volatile boolean hasBufferedInput

contentEncoder

protected volatile ContentEncoder contentEncoder

hasBufferedOutput

protected volatile boolean hasBufferedOutput

request

protected volatile org.apache.http.HttpRequest request

response

protected volatile org.apache.http.HttpResponse response

status

protected volatile int status
Constructor Detail

NHttpConnectionBase

public NHttpConnectionBase(IOSession session,
                           ByteBufferAllocator allocator,
                           org.apache.http.params.HttpParams params)
Method Detail

getStatus

public int getStatus()
Specified by:
getStatus in interface NHttpConnection

getContext

public org.apache.http.protocol.HttpContext getContext()
Description copied from interface: NHttpConnection
Returns an HTTP execution context associated with this connection.

Specified by:
getContext in interface NHttpConnection
Returns:
HTTP context

getHttpRequest

public org.apache.http.HttpRequest getHttpRequest()
Description copied from interface: NHttpConnection
Returns the current HTTP request if one is being received / transmitted. Otherwise returns null.

Specified by:
getHttpRequest in interface NHttpConnection
Returns:
an HTTP request if available. Otherwise returns null.

getHttpResponse

public org.apache.http.HttpResponse getHttpResponse()
Description copied from interface: NHttpConnection
Returns the current HTTP response if one is being received / transmitted. Otherwise returns null.

Specified by:
getHttpResponse in interface NHttpConnection
Returns:
an HTTP response if available. Otherwise returns null.

requestInput

public void requestInput()
Description copied from interface: IOControl
Requests event notifications to be triggered when the underlying channel is ready for input oprtations.

Specified by:
requestInput in interface IOControl

requestOutput

public void requestOutput()
Description copied from interface: IOControl
Requests event notifications to be triggered when the underlying channel is ready for output oprtations.

Specified by:
requestOutput in interface IOControl

suspendInput

public void suspendInput()
Description copied from interface: IOControl
Suspends event notifications about the underlying channel being ready for input operations.

Specified by:
suspendInput in interface IOControl

suspendOutput

public void suspendOutput()
Description copied from interface: IOControl
Suspends event notifications about the underlying channel being ready for output operations.

Specified by:
suspendOutput in interface IOControl

prepareDecoder

protected org.apache.http.HttpEntity prepareDecoder(org.apache.http.HttpMessage message)
                                             throws org.apache.http.HttpException
Throws:
org.apache.http.HttpException

prepareEncoder

protected void prepareEncoder(org.apache.http.HttpMessage message)
                       throws org.apache.http.HttpException
Throws:
org.apache.http.HttpException

hasBufferedInput

public boolean hasBufferedInput()
Specified by:
hasBufferedInput in interface SessionBufferStatus

hasBufferedOutput

public boolean hasBufferedOutput()
Specified by:
hasBufferedOutput in interface SessionBufferStatus

assertNotClosed

protected void assertNotClosed()
                        throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface org.apache.http.HttpConnection
Throws:
java.io.IOException

isOpen

public boolean isOpen()
Specified by:
isOpen in interface org.apache.http.HttpConnection

isStale

public boolean isStale()
Specified by:
isStale in interface org.apache.http.HttpConnection

getLocalAddress

public java.net.InetAddress getLocalAddress()
Specified by:
getLocalAddress in interface org.apache.http.HttpInetConnection

getLocalPort

public int getLocalPort()
Specified by:
getLocalPort in interface org.apache.http.HttpInetConnection

getRemoteAddress

public java.net.InetAddress getRemoteAddress()
Specified by:
getRemoteAddress in interface org.apache.http.HttpInetConnection

getRemotePort

public int getRemotePort()
Specified by:
getRemotePort in interface org.apache.http.HttpInetConnection

setSocketTimeout

public void setSocketTimeout(int timeout)
Specified by:
setSocketTimeout in interface org.apache.http.HttpConnection

getSocketTimeout

public int getSocketTimeout()
Specified by:
getSocketTimeout in interface org.apache.http.HttpConnection

shutdown

public void shutdown()
              throws java.io.IOException
Description copied from interface: IOControl
Shuts down the underlying channel.

Specified by:
shutdown in interface org.apache.http.HttpConnection
Specified by:
shutdown in interface IOControl
Throws:
java.io.IOException

getMetrics

public org.apache.http.HttpConnectionMetrics getMetrics()
Specified by:
getMetrics in interface org.apache.http.HttpConnection


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