org.apache.commons.httpclient

Class SimpleHttpConnectionManager

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

Field Summary
protected HttpConnectionhttpConnection
The http connection
Constructor Summary
SimpleHttpConnectionManager(boolean alwaysClose)
The connection manager created with this constructor will try to keep the connection open (alive) between consecutive requests if the alwaysClose parameter is set to false.
SimpleHttpConnectionManager()
The connection manager created with this constructor will always try to keep the connection open (alive) between consecutive requests.
Method Summary
voidcloseIdleConnections(long idleTimeout)
HttpConnectiongetConnection(HostConfiguration hostConfiguration)
HttpConnectiongetConnection(HostConfiguration hostConfiguration, long timeout)
HttpConnectiongetConnectionWithTimeout(HostConfiguration hostConfiguration, long timeout)
This method always returns the same connection object.
HttpConnectionManagerParamsgetParams()
Returns parameters associated with this connection manager.
booleanisConnectionStaleCheckingEnabled()
Gets the staleCheckingEnabled value to be set on HttpConnections that are created.
voidreleaseConnection(HttpConnection conn)
voidsetConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
Sets the staleCheckingEnabled value to be set on HttpConnections that are created.
voidsetParams(HttpConnectionManagerParams params)
Assigns parameters for this connection manager.
voidshutdown()
since 3.1

Field Detail

httpConnection

protected HttpConnection httpConnection
The http connection

Constructor Detail

SimpleHttpConnectionManager

public SimpleHttpConnectionManager(boolean alwaysClose)
The connection manager created with this constructor will try to keep the connection open (alive) between consecutive requests if the alwaysClose parameter is set to false. Otherwise the connection manager will always close connections upon release.

Parameters: alwaysClose if set true, the connection manager will always close connections upon release.

SimpleHttpConnectionManager

public SimpleHttpConnectionManager()
The connection manager created with this constructor will always try to keep the connection open (alive) between consecutive requests.

Method Detail

closeIdleConnections

public void closeIdleConnections(long idleTimeout)

Since: 3.0

getConnection

public HttpConnection getConnection(HostConfiguration hostConfiguration)

See Also: getConnection

getConnection

public HttpConnection getConnection(HostConfiguration hostConfiguration, long timeout)

Deprecated: Use #getConnectionWithTimeout(HostConfiguration, long)

See Also:

getConnectionWithTimeout

public HttpConnection getConnectionWithTimeout(HostConfiguration hostConfiguration, long timeout)
This method always returns the same connection object. If the connection is already open, it will be closed and the new host configuration will be applied.

Parameters: hostConfiguration The host configuration specifying the connection details. timeout this parameter has no effect. The connection is always returned immediately.

Since: 3.0

getParams

public HttpConnectionManagerParams getParams()
Returns parameters associated with this connection manager.

Since: 2.1

See Also: HttpConnectionManagerParams

isConnectionStaleCheckingEnabled

public boolean isConnectionStaleCheckingEnabled()

Deprecated: Use HttpConnectionManagerParams, getParams.

Gets the staleCheckingEnabled value to be set on HttpConnections that are created.

Returns: true if stale checking will be enabled on HttpConections

See Also:

releaseConnection

public void releaseConnection(HttpConnection conn)

See Also: releaseConnection

setConnectionStaleCheckingEnabled

public void setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)

Deprecated: Use HttpConnectionManagerParams, getParams.

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:

setParams

public void setParams(HttpConnectionManagerParams params)
Assigns parameters for this connection manager.

Since: 2.1

See Also: HttpConnectionManagerParams

shutdown

public void shutdown()
since 3.1
Copyright (c) 1999-2005 - Apache Software Foundation