hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject HttpUriRequest.getURI() returns relative URI?
Date Mon, 06 Dec 2010 20:39:47 GMT
I'm following the example in the HttpClient documentation:

            DefaultHttpClient httpclient = new DefaultHttpClient();
            HttpContext localContext = new BasicHttpContext();
            HttpGet httpget = new HttpGet("http://www.google.com/");
            HttpResponse response = httpclient.execute(httpget, localContext);
            HttpHost target = (HttpHost) localContext.getAttribute(
                    ExecutionContext.HTTP_TARGET_HOST);
            HttpUriRequest req = (HttpUriRequest) localContext.getAttribute(
                    ExecutionContext.HTTP_REQUEST);
            System.out.println("Target host: " + target);
            System.out.println("Final request URI: " + req.getURI());

I see the following output:

Target host: http://www.google.co.uk
Final request URI: /

However, I would expect to see an absolute URI, as per the Javadoc for
HttpUriRequest#getURI().

Is this a bug in the Javadoc (and user guide?) or a bug in the code?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message