org.apache.commons.httpclient
Class SimpleHttpConnectionManager

java.lang.Object
  |
  +--org.apache.commons.httpclient.SimpleHttpConnectionManager
All Implemented Interfaces:
HttpConnectionManager

public class SimpleHttpConnectionManager
extends Object
implements HttpConnectionManager

A connection manager that provides access to a single HttpConnection. This manager makes no attempt to provide exclusive access to the contained HttpConnection.

Since:
2.0
Author:
Michael Becke, Eric Johnson, Mike Bowler, Oleg Kalnichevski, Laura Werner

Constructor Summary
SimpleHttpConnectionManager()
          Constructor for SimpleHttpConnectionManager.
 
Method Summary
(package private) static void finishLastResponse(HttpConnection conn)
          Since the same connection is about to be reused, make sure the previous request was completely processed, and if not consume it now.
 HttpConnection getConnection(HostConfiguration hostConfiguration)
          Gets an HttpConnection for a given host configuration.
 HttpConnection getConnection(HostConfiguration hostConfiguration, long timeout)
          Gets an HttpConnection for a given host configuration.
 boolean isConnectionStaleCheckingEnabled()
          Gets the staleCheckingEnabled value to be set on HttpConnections that are created.
 void releaseConnection(HttpConnection conn)
          Releases the given HttpConnection for use by other requests.
 void setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
          Sets the staleCheckingEnabled value to be set on HttpConnections that are created.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleHttpConnectionManager

public SimpleHttpConnectionManager()
Constructor for SimpleHttpConnectionManager.
Method Detail

getConnection

public HttpConnection getConnection(HostConfiguration hostConfiguration)
Description copied from interface: HttpConnectionManager
Gets an HttpConnection for a given host configuration. If a connection is not available this method will block until one is. The connection manager should be registered with any HttpConnection that is created.
Specified by:
getConnection in interface HttpConnectionManager
See Also:
HttpConnectionManager.getConnection(HostConfiguration)

isConnectionStaleCheckingEnabled

public boolean isConnectionStaleCheckingEnabled()
Gets the staleCheckingEnabled value to be set on HttpConnections that are created.
Returns:
true if stale checking will be enabled on HttpConections
See Also:
HttpConnection.isStaleCheckingEnabled()

setConnectionStaleCheckingEnabled

public void setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
Sets the staleCheckingEnabled value to be set on HttpConnections that are created.
Parameters:
connectionStaleCheckingEnabled - true if stale checking will be enabled on HttpConections
See Also:
HttpConnection.setStaleCheckingEnabled(boolean)

getConnection

public HttpConnection getConnection(HostConfiguration hostConfiguration,
                                    long timeout)
Description copied from interface: HttpConnectionManager
Gets an HttpConnection for a given host configuration. If a connection is not available, this method will block for at most the specified number of milliseconds or until a connection becomes available. The connection manager should be registered with any HttpConnection that is created.
Specified by:
getConnection in interface HttpConnectionManager
See Also:
HttpConnectionManager.getConnection(HostConfiguration, long)

releaseConnection

public void releaseConnection(HttpConnection conn)
Description copied from interface: HttpConnectionManager
Releases the given HttpConnection for use by other requests.
Specified by:
releaseConnection in interface HttpConnectionManager
See Also:
HttpConnectionManager.releaseConnection(org.apache.commons.httpclient.HttpConnection)

finishLastResponse

static void finishLastResponse(HttpConnection conn)
Since the same connection is about to be reused, make sure the previous request was completely processed, and if not consume it now.
Parameters:
conn - The connection


Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.