hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdrsantosh <gdrsant...@gmail.com>
Subject Handling Url's redirection using Httpclient
Date Tue, 10 Feb 2015 12:35:43 GMT
I am using Httpclient to get the web page content,when we specify below urls
like

http://www.milwaukeetool.com/power-tools#product+Types=Diamond+Coring
it will be redirected to 
http://www.milwaukeetool.com/power-tools?product+Types=Diamond+Coring

and 

http://blackwoods.com.au/browse/flat-cut-off-wheels-metal-flexovit/302022874
it will be redirected to
http://blackwoods.com.au/search/flat-cut-off-wheels-metal-flexovit/302022874

and giving invalid page content.

So, I am looking for a solution to handle rediection to get correct page
content using HttpClient.
Below is the code which I am using to handle redirection using httpclient..

HttpGet httpGet = new HttpGet(UrlRequest);
httpclient = HttpClientBuilder.create().setRedirectStrategy(new
LaxRedirectStrategy()).build();
HttpResponse  response = httpclient.execute(httpGet);
HttpEntity entity = response.getEntity(); 
thirdPartyPageContent=EntityUtils.toString(entity);




--
View this message in context: http://httpcomponents.10934.n7.nabble.com/Handling-Url-s-redirection-using-Httpclient-tp25485.html
Sent from the HttpClient-User mailing list archive at Nabble.com.

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


Mime
View raw message