Hi,
I would like to get the following code snippet to work using the HttpClient 4.0 
alpha-4 release:

=========== 
DefaultHttpClient  httpclient = new DefaultHttpClient(); 
httpclient.getCredentialsProvider().setCredentials( 
        new AuthScope("localhost", 8080), 
        new UsernamePasswordCredentials("user", "pw")); 
HttpHost targetHost = new HttpHost("www.google.co.uk", 80); 
HttpHost proxy = new HttpHost("localhost", 8080); 
HttpRoute route = new HttpRoute(targetHost, null, proxy, false); 
HttpGet httpget = new HttpGet("http://www.google.co.uk/";); 
RoutedRequest routedReq = new RoutedRequest.Impl(httpget, route); 
System.out.println("executing request to " + route); 
HttpResponse response = httpclient.execute(routedReq, null); 
HttpEntity entity = response.getEntity(); 
System.out.println("----------------------------------------"); 
System.out.println(response.getStatusLine()); 
if (entity != null) { 
    System.out.println("Response content length: " + 
entity.getContentLength()); 
    System.out.println("Chunked?: " + entity.isChunked()); 
} 
if (entity != null) { 
    entity.consumeContent(); 
} 
System.out.println("----------------------------------------"); 
=========== 

Unfortunately,it appears the RoutedRequest.Impl class has disappeared from the 
API since Alpha-3.  Any ideas of how I can do this with the current release?

Cheers,

Simon.

Reply via email to