com.microsoft.tfs.core.config.httpclient
Interface ConfigurableHTTPClientFactory

All Superinterfaces:
HTTPClientFactory
All Known Implementing Classes:
DefaultHTTPClientFactory

public interface ConfigurableHTTPClientFactory
extends HTTPClientFactory

Adds methods to HTTPClientFactory to allow granular configuration of properties on existing HttpClient instances.


Method Summary
 void configureClient(HttpClient httpClient, ConnectionInstanceData connectionInstanceData)
          Called from HTTPClientFactory.newHTTPClient() to perform final configuration of a new HttpClient instance before it is returned to the caller of that method.
 void configureClientCredentials(HttpClient httpClient, HttpState state, ConnectionInstanceData connectionInstanceData)
          Called from HTTPClientFactory.newHTTPClient() to configure credentials for a new HttpClient instance.
 void configureClientParams(HttpClient httpClient, HttpClientParams params, ConnectionInstanceData connectionInstanceData)
          Called from HTTPClientFactory.newHTTPClient() to configure a new HttpClient's HttpClientParams.
 void configureClientProxy(HttpClient httpClient, HostConfiguration hostConfiguration, HttpState httpState, ConnectionInstanceData connectionInstanceData)
          Called from HTTPClientFactory.newHTTPClient() to configure proxy settings for a new HttpClient instance.
 HttpConnectionManager createConnectionManager(ConnectionInstanceData connectionInstanceData)
          Called from HTTPClientFactory.newHTTPClient() to create and configure a new HttpConnectionManager as part of creating a new HttpClient instance.
 HttpClient createHTTPClient(HttpConnectionManager connectionManager, ConnectionInstanceData connectionInstanceData)
          Called from HTTPClientFactory.newHTTPClient() to create a new HttpClient.
 java.lang.String getUserAgent(HttpClient httpClient, ConnectionInstanceData connectionInstanceData)
          Called from configureClientParams(HttpClient, HttpClientParams, ConnectionInstanceData) to obtain a user-agent string to configure a new HttpClient with.
 
Methods inherited from interface com.microsoft.tfs.core.config.httpclient.HTTPClientFactory
dispose, newHTTPClient
 

Method Detail

createConnectionManager

HttpConnectionManager createConnectionManager(ConnectionInstanceData connectionInstanceData)
Called from HTTPClientFactory.newHTTPClient() to create and configure a new HttpConnectionManager as part of creating a new HttpClient instance. Subclasses may override. The default behavior is to instantiate a MultiThreadedHttpConnectionManager and configure it with some default parameters.

Returns:
a new HttpConnectionManager (must not be null)

createHTTPClient

HttpClient createHTTPClient(HttpConnectionManager connectionManager,
                            ConnectionInstanceData connectionInstanceData)
Called from HTTPClientFactory.newHTTPClient() to create a new HttpClient. Most of the configuration should be done by other methods - see the javadoc on those methods for details. This method is called after createConnectionManager(ConnectionInstanceData) and is passed the HttpConnectionManager returned from that method. Subclasses may override.

Parameters:
connectionManager - the HttpConnectionManager returned from createConnectionManager(ConnectionInstanceData) (never null )
connectionInstanceData - the ConnectionInstanceData being used to supply configuration data (never null)
Returns:
a new HttpClient instance (must not be null)

configureClientParams

void configureClientParams(HttpClient httpClient,
                           HttpClientParams params,
                           ConnectionInstanceData connectionInstanceData)
Called from HTTPClientFactory.newHTTPClient() to configure a new HttpClient's HttpClientParams. Subclasses may override. The default behavior is to configure the http.protocol.expect-continue parameter to false and set a custom user agent string.

Parameters:
httpClient - the HttpClient being configured (never null)
params - the HttpClientParams to configure (never null )
connectionInstanceData - the ConnectionInstanceData being used to supply configuration data (never null)

getUserAgent

java.lang.String getUserAgent(HttpClient httpClient,
                              ConnectionInstanceData connectionInstanceData)
Called from configureClientParams(HttpClient, HttpClientParams, ConnectionInstanceData) to obtain a user-agent string to configure a new HttpClient with.

Parameters:
httpClient - the HttpClient being configured (never null)
connectionInstanceData - the ConnectionInstanceData being used to supply configuration data (never null)
Returns:
the user-agent string to use, or null to not configure a user-agent

configureClientCredentials

void configureClientCredentials(HttpClient httpClient,
                                HttpState state,
                                ConnectionInstanceData connectionInstanceData)
Called from HTTPClientFactory.newHTTPClient() to configure credentials for a new HttpClient instance. Subclasses may override. The default behavior is to call #createCredentials(ConnectionInstanceData). If that method returns a non-null Credentials object, then that object is set as the credentials for the HttpState.

Parameters:
httpClient - the HttpClient being configured (never null)
state - the HttpState to configure credentials on (never null)
connectionInstanceData - the ConnectionInstanceData being used to supply configuration data (never null)

configureClientProxy

void configureClientProxy(HttpClient httpClient,
                          HostConfiguration hostConfiguration,
                          HttpState httpState,
                          ConnectionInstanceData connectionInstanceData)
Called from HTTPClientFactory.newHTTPClient() to configure proxy settings for a new HttpClient instance. Subclasses may override.

Parameters:
httpClient - the HttpClient being configured (never null)
hostConfiguration - the HostConfiguration of the new HttpClient instance (never null)
httpState - the HttpState of the new HttpClient instance (never null)
connectionInstanceData - the ConnectionInstanceData being used to supply configuration data (never null)

configureClient

void configureClient(HttpClient httpClient,
                     ConnectionInstanceData connectionInstanceData)
Called from HTTPClientFactory.newHTTPClient() to perform final configuration of a new HttpClient instance before it is returned to the caller of that method. Subclasses may override. The default behavior is to call #addClientToCloserThread(HttpClient) with the new client instance.

Parameters:
httpClient - the new HttpClient instance (never null)
connectionInstanceData - the ConnectionInstanceData being used to supply configuration data (never null)


© 2015 Microsoft. All rights reserved.