builder.setState(state);
builder.setConnectionTimeout(timeout);
builder.setRoundTripTimeout(timeout);
// create the HTTPClient instance.
final HttpClient httpClient = builder.buildHttpClient();
// return an HTTPRequestExecutor that uses HttpClient to perform
// the request
return new HTTPRequestExecutor() {
/**
* The request method to use.
*/
HttpMethod method = null;
/**
* The list of request parameters
*/
List requestParameters = null;
/**
* A list containing the request headers.
*/
List requestHeaders = null;
// javadoc inherited
public HTTPResponseAccessor execute() throws HTTPException {
// create the request method this will be POST or GET depending
// on the requestType argument. This will copy the request
// parameters to the appropraite place.
method = createMethod(url, requestType, requestParameters);
transferRequestHeaders(method, requestHeaders);
// set the http version for the request
((HttpMethodBase) method).setHttp11(
version == HTTPVersion.HTTP_1_1);
if (proxyManager != null) {
try {
URL realUrl = new URL(url);
// Get the proxy config to use for the host.
Proxy proxy = proxyManager.getProxyForHost(
realUrl.getHost());
if (proxy != null) {
method.getHostConfiguration().
setProxy(proxy.getHost(), proxy.getPort());
if (proxy.useAuthorization()) {
method.setDoAuthentication(true);
// mock up a authentication challenge so we can get
// the response (which can be sent before the
// challenge if we want to save time and effort)
method.setRequestHeader(
HTTPAuthorizationScheme.PROXY_AUTHORIZATION_HEADER,
HTTPAuthorizationScheme.BASIC.
createResponseForChallenge(HTTPAuthorizationScheme.MOCK_CHALLENGE_BASIC,
proxy));
}
}
} catch (MalformedURLException mue) {
LOGGER.error(mue);
}
}
try {
HttpStatusCode statusCode = httpClient.executeMethod(method);
if (xmlPipelineContext != null) {
final DependencyContext dependencyContext =
xmlPipelineContext.getDependencyContext();
if (dependencyContext != null &&
dependencyContext.isTrackingDependencies()) {