Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.http.impl
Class AbstractHttpConnection  view AbstractHttpConnection download AbstractHttpConnection.java

java.lang.Object
  extended byorg.apache.http.impl.AbstractHttpConnection
All Implemented Interfaces:
org.apache.http.HttpConnection
Direct Known Subclasses:
DefaultHttpClientConnection, DefaultHttpServerConnection

abstract class AbstractHttpConnection
extends java.lang.Object
implements org.apache.http.HttpConnection

Abstract base class for HTTP connections on the client and server side.

Since:
4.0
Version:
$Revision: 410884 $

Field Summary
protected  org.apache.http.io.HttpDataReceiver datareceiver
           
protected  org.apache.http.io.HttpDataTransmitter datatransmitter
           
protected  boolean open
           
private  org.apache.http.io.HttpDataReceiverFactory rcvfactory
           
protected  java.net.Socket socket
           
private  org.apache.http.io.HttpDataTransmitterFactory trxfactory
           
 
Constructor Summary
protected AbstractHttpConnection()
           
 
Method Summary
protected  void assertNotOpen()
           
protected  void assertOpen()
           
protected  void bind(java.net.Socket socket, org.apache.http.params.HttpParams params)
           
 void close()
          This method will gracefully close the connection.
 boolean isOpen()
          Checks if this connection is open.
 boolean isStale()
          Network connections may get closed during some time of inactivity for several reasons.
 void setReceiverFactory(org.apache.http.io.HttpDataReceiverFactory rcvfactory)
           
 void setTransmitterFactory(org.apache.http.io.HttpDataTransmitterFactory trxfactory)
           
 void shutdown()
          This method will force close the connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

open

protected volatile boolean open

socket

protected java.net.Socket socket

datatransmitter

protected org.apache.http.io.HttpDataTransmitter datatransmitter

datareceiver

protected org.apache.http.io.HttpDataReceiver datareceiver

trxfactory

private org.apache.http.io.HttpDataTransmitterFactory trxfactory

rcvfactory

private org.apache.http.io.HttpDataReceiverFactory rcvfactory
Constructor Detail

AbstractHttpConnection

protected AbstractHttpConnection()
Method Detail

setReceiverFactory

public void setReceiverFactory(org.apache.http.io.HttpDataReceiverFactory rcvfactory)

setTransmitterFactory

public void setTransmitterFactory(org.apache.http.io.HttpDataTransmitterFactory trxfactory)

assertNotOpen

protected void assertNotOpen()

assertOpen

protected void assertOpen()

bind

protected void bind(java.net.Socket socket,
                    org.apache.http.params.HttpParams params)
             throws java.io.IOException

isOpen

public boolean isOpen()
Description copied from interface: org.apache.http.HttpConnection
Checks if this connection is open.

Specified by:
isOpen in interface org.apache.http.HttpConnection

shutdown

public void shutdown()
              throws java.io.IOException
Description copied from interface: org.apache.http.HttpConnection
This method will force close the connection. This is the only method, which may be called from a different thread to terminate the connection. This method will not attempt to flush the transmitter's internal buffer prior to closing the underlying socket.

Specified by:
shutdown in interface org.apache.http.HttpConnection

close

public void close()
           throws java.io.IOException
Description copied from interface: org.apache.http.HttpConnection
This method will gracefully close the connection. It will attempt to flush the transmitter's internal buffer prior to closing the underlying socket. This method MAY NOT be called from a different thread to force shutdown the connection. Use #shutdown() instead.

Specified by:
close in interface org.apache.http.HttpConnection

isStale

public boolean isStale()
Description copied from interface: org.apache.http.HttpConnection
Network connections may get closed during some time of inactivity for several reasons. The next time a read is attempted on such a connection it will throw an IOException. This method tries to alleviate this inconvenience by trying to find out if a connection is still usable. Implementations may do that by attempting a read with a very small timeout. Thus this method may block for a small indefinite time before returning a result.

Specified by:
isStale in interface org.apache.http.HttpConnection