* Construct the client factory bean with user credentials.
*/
public HttpComponentsClientHttpRequestFactory getObject() throws Exception {
Assert.notNull(credentials, "User credentials not set properly!");
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient) {
@Override
protected HttpContext createHttpContext(HttpMethod httpMethod, URI uri) {
// we have to use preemptive authentication
// therefore add some basic auth cache to the local context
AuthCache authCache = new BasicAuthCache();