Hello,

On Tue, Feb 10, 2015 at 5:35 AM, gdrsantosh <[email protected]> wrote:
> 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

Looking at the sites, they are using Javascript (document.location) to
redirect, rather than HTTP 3xx status codes. So, this is outside the
scope of HTTP Client. You will have to parse/process the HTML body and
Javascript to achieve that redirect.

Regards,
Bindul

>
> 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: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to