org.apache.http
Interface HttpConnection

All Known Subinterfaces:
HttpClientConnection, HttpProxyConnection, HttpServerConnection
All Known Implementing Classes:
AbstractHttpConnection, DefaultHttpClientConnection, DefaultHttpProxyConnection, DefaultHttpServerConnection

public interface HttpConnection

A generic HTTP connection, useful on client and server side.

Since:
4.0
Version:
$Revision: 391135 $
Author:
Oleg Kalnichevski

Method Summary
 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 shutdown()
          This method will force close the connection.
 

Method Detail

close

void close()
           throws java.io.IOException
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.

Throws:
java.io.IOException
See Also:
shutdown()

isOpen

boolean isOpen()
Checks if this connection is open.

Returns:
true if it is open, false if it is closed.

isStale

boolean isStale()
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.

Returns:
true if attempts to use this connection are likely to succeed, false if they are likely to fail and this connection should be closed and discarded.

shutdown

void shutdown()
              throws java.io.IOException
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.

Throws:
java.io.IOException


Copyright 2005-2005-2006 Apache Software Foundation. All Rights Reserved.