public class HttpClientHelper extends HttpClientHelper
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. |
hostnameVerifier | String | null | Class name of the hostname verifier to use instead of HTTP Client default behavior. The given class name must implement org.apache.http.conn.ssl.X509HostnameVerifier and have default no-arg constructor. |
idleCheckInterval | int | 0 | Time between checks for idle and expired connections. The check happens only if this property is set to a value greater than 0. |
idleTimeout | long | 60000 | Returns the time in ms beyond which idle connections are eligible for reaping. The default value is 60000 ms. |
maxConnectionsPerHost | int | 10 | 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. |
proxyHost | String | System property "http.proxyHost" | The host name of the HTTP proxy. |
proxyPort | int | System property "http.proxyPort" or "3128" | The port of the HTTP proxy. |
retryHandler | String | null | Class name of the retry handler to use instead of HTTP Client default behavior. The given class name must extend the org.apache.http.client.HttpRequestRetryHandler class and have a default constructor |
socketConnectTimeoutMs | int | 15000 | The socket connection timeout or 0 for unlimited wait. |
socketTimeout | int | 60000 | Sets the socket timeout to a specified timeout, in milliseconds. A timeout of zero is interpreted as an infinite timeout. |
stopIdleTimeout | int | 60000 | The minimum idle time, in milliseconds, for connections to be closed when stopping the connector. |
tcpNoDelay | boolean | false | Indicate if Nagle's TCP_NODELAY algorithm should be used. |
sslContextFactory | String | org.restlet.engine.ssl.DefaultSslContextFactory | Let you specify a SslContextFactory qualified class name as a
parameter, or an instance as an attribute for a more complete and flexible
SSL context setting. |
DefaultSslContextFactory
class.Constructor and Description |
---|
HttpClientHelper(Client client)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
configure(org.apache.http.impl.client.DefaultHttpClient httpClient)
Configures the HTTP client.
|
protected void |
configure(org.apache.http.params.HttpParams params)
Configures the various parameters of the connection manager and the HTTP
client.
|
protected void |
configure(org.apache.http.conn.scheme.SchemeRegistry schemeRegistry)
Configures the scheme registry.
|
ClientCall |
create(Request request)
Creates a low-level HTTP client call from a high-level uniform call.
|
protected org.apache.http.conn.ClientConnectionManager |
createClientConnectionManager(org.apache.http.params.HttpParams params,
org.apache.http.conn.scheme.SchemeRegistry schemeRegistry)
Creates the connection manager.
|
java.lang.String |
getHostnameVerifier()
Returns the class name of the hostname verifier to use instead of HTTP
Client default behavior.
|
org.apache.http.client.HttpClient |
getHttpClient()
Returns the wrapped Apache HTTP Client.
|
long |
getIdleCheckInterval()
Time in milliseconds between two checks for idle and expired connections.
|
long |
getIdleTimeout()
Returns the time in ms beyond which idle connections are eligible for
reaping.
|
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.
|
java.lang.String |
getProxyHost()
Returns the host name of the HTTP proxy, if specified.
|
int |
getProxyPort()
Returns the port of the HTTP proxy, if specified, 3128 otherwise.
|
java.lang.String |
getRetryHandler()
Returns the class name of the retry handler to use instead of HTTP Client
default behavior.
|
int |
getSocketConnectTimeoutMs()
Returns the connection timeout.
|
int |
getSocketTimeout()
Returns the socket timeout value.
|
int |
getStopIdleTimeout()
Returns the minimum idle time, in milliseconds, for connections to be
closed when stopping the connector.
|
boolean |
getTcpNoDelay()
Indicates if the protocol will use Nagle's algorithm
|
boolean |
isFollowRedirects()
Indicates if the protocol will automatically follow redirects.
|
void |
setIdleConnectionReaper(org.restlet.ext.httpclient.internal.HttpIdleConnectionReaper connectionReaper)
Sets the idle connections reaper.
|
void |
start() |
void |
stop() |
getAdapter, handle, setAdapter
getConnectorService, getContext, getProtocols, update
getAttributes, getHelped, getHelpedParameters, getLogger, getMetadataService, setHelped
public HttpClientHelper(Client client)
client
- The client to help.protected void configure(org.apache.http.impl.client.DefaultHttpClient httpClient)
httpClient
- The HTTP client to configure.protected void configure(org.apache.http.params.HttpParams params)
params
- The parameter list to update.protected void configure(org.apache.http.conn.scheme.SchemeRegistry schemeRegistry)
schemeRegistry
- The scheme registry to configure.public ClientCall create(Request request)
create
in class HttpClientHelper
request
- The high-level request.protected org.apache.http.conn.ClientConnectionManager createClientConnectionManager(org.apache.http.params.HttpParams params, org.apache.http.conn.scheme.SchemeRegistry schemeRegistry)
params
- The configuration parameters.schemeRegistry
- The scheme registry to use.public java.lang.String getHostnameVerifier()
public org.apache.http.client.HttpClient getHttpClient()
public long getIdleCheckInterval()
getIdleTimeout()
public long getIdleTimeout()
getIdleCheckInterval()
public int getMaxConnectionsPerHost()
public int getMaxTotalConnections()
public java.lang.String getProxyHost()
public int getProxyPort()
public java.lang.String getRetryHandler()
public int getSocketConnectTimeoutMs()
getSocketConnectTimeoutMs
in class HttpClientHelper
public int getSocketTimeout()
public int getStopIdleTimeout()
public boolean getTcpNoDelay()
Socket.setTcpNoDelay(boolean)
public boolean isFollowRedirects()
public void setIdleConnectionReaper(org.restlet.ext.httpclient.internal.HttpIdleConnectionReaper connectionReaper)
connectionReaper
- The idle connections reaper.public void start() throws java.lang.Exception
start
in class ConnectorHelper<Client>
java.lang.Exception
public void stop() throws java.lang.Exception
stop
in class ConnectorHelper<Client>
java.lang.Exception
Copyright © 2005-2024 Restlet.