com.noelios.restlet.ext.httpclient
Class HttpClientHelper

java.lang.Object
  extended by org.restlet.util.Helper
      extended by com.noelios.restlet.ConnectorHelper
          extended by com.noelios.restlet.ClientHelper
              extended by com.noelios.restlet.http.HttpClientHelper
                  extended by com.noelios.restlet.ext.httpclient.HttpClientHelper

public class HttpClientHelper
extends HttpClientHelper

HTTP client connector using the HttpMethodCall and Apache HTTP Client project. Note that the response must be fully read in all cases in order to surely release the underlying connection. Not doing so may cause future requests to block.

Author:
Jerome Louvel (contact@noelios.com)
See Also:
Here is the list of parameters that are supported:
Parameter name Value type Default value Description
followRedirects boolean false If true, the protocol will automatically follow redirects. If false, the protocol will not automatically follow redirects.
maxConnectionsPerHost int 2 (uses HttpClient's default) The maximum number of connections that will be created for any particular host.
maxTotalConnections int 20 (uses HttpClient's default) The maximum number of active connections.
connectionManagerTimeout int 0 The timeout in milliseconds used when retrieving an HTTP connection from the HTTP connection manager.
stopIdleTimeout int 1000 The minimum idle time, in milliseconds, for connections to be closed when stopping the connector.
readTimeout int 0 Sets the read timeout to a specified timeout, in milliseconds. A timeout of zero is interpreted as an infinite timeout.
, Networking Features

Constructor Summary
HttpClientHelper(Client client)
          Constructor.
 
Method Summary
 HttpClientCall create(Request request)
          Creates a low-level HTTP client call from a high-level uniform call.
 int getConnectionManagerTimeout()
          Returns the timeout in milliseconds used when retrieving an HTTP connection from the HTTP connection manager.
 HttpClient getHttpClient()
           
 int getMaxConnectionsPerHost()
          Returns the maximum number of connections that will be created for any particular host.
 int getMaxTotalConnections()
          Returns the maximum number of active connections.
 int getReadTimeout()
          Returns the read timeout value.
 int getStopIdleTimeout()
          Returns the minimum idle time, in milliseconds, for connections to be closed when stopping the connector.
 boolean isFollowRedirects()
          Indicates if the protocol will automatically follow redirects.
 void start()
           
 void stop()
           
 
Methods inherited from class com.noelios.restlet.http.HttpClientHelper
getConverter, handle, setConverter
 
Methods inherited from class com.noelios.restlet.ClientHelper
getClient, getContext, getLogger, getParameters
 
Methods inherited from class com.noelios.restlet.ConnectorHelper
createContext, getProtocols
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientHelper

public HttpClientHelper(Client client)
Constructor.

Parameters:
client - The client to help.
Method Detail

getHttpClient

public HttpClient getHttpClient()

start

public void start()
           throws Exception
Overrides:
start in class ConnectorHelper
Throws:
Exception

stop

public void stop()
          throws Exception
Overrides:
stop in class ConnectorHelper
Throws:
Exception

create

public HttpClientCall create(Request request)
Creates a low-level HTTP client call from a high-level uniform call.

Specified by:
create in class HttpClientHelper
Parameters:
request - The high-level request.
Returns:
A low-level HTTP client call.

isFollowRedirects

public boolean isFollowRedirects()
Indicates if the protocol will automatically follow redirects.

Returns:
True if the protocol will automatically follow redirects.

getMaxConnectionsPerHost

public int getMaxConnectionsPerHost()
Returns the maximum number of connections that will be created for any particular host.

Returns:
The maximum number of connections that will be created for any particular host.

getMaxTotalConnections

public int getMaxTotalConnections()
Returns the maximum number of active connections.

Returns:
The maximum number of active connections.

getConnectionManagerTimeout

public int getConnectionManagerTimeout()
Returns the timeout in milliseconds used when retrieving an HTTP connection from the HTTP connection manager.

Returns:
The timeout in milliseconds used when retrieving an HTTP connection from the HTTP connection manager.

getStopIdleTimeout

public int getStopIdleTimeout()
Returns the minimum idle time, in milliseconds, for connections to be closed when stopping the connector.

Returns:
The minimum idle time, in milliseconds, for connections to be closed when stopping the connector.

getReadTimeout

public int getReadTimeout()
Returns the read timeout value. A timeout of zero is interpreted as an infinite timeout.

Returns:
The read timeout value.


Copyright © 2005-2007 Noelios Consulting.