Re: Redirection in httpClient

2018-06-25 Thread Oleg Kalnichevski
On Mon, 2018-06-25 at 09:14 +, Khare, Aparna wrote:
> Hi All,
>  
>   We have moved our application to version 4.5.2 and we want to check
> how we can configure our httpclient to handle redirection ..
>  
> We connect to the proxy agent which takes only http calls. The
> redirected URL is https how can we enable the redirection only make
> an connection( HTTP proxy ).
>  
> Can we make redirectionStrategy to only make HTTP call even the call
> is https..
>  
> Thanks,
> Aparna

Aparna


You can either

1. use a custom RedirectStrategy that rewrites redirect locations from
https:// to http://

2. use custom HttpRoutePlanner to route all requests to 'http' port
instead of 'https'

Hope this helps

Oleg

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



Redirection in httpClient

2018-06-25 Thread Khare, Aparna
Hi All,

  We have moved our application to version 4.5.2 and we want to check how we 
can configure our httpclient to handle redirection ..

We connect to the proxy agent which takes only http calls. The redirected URL 
is https how can we enable the redirection only make an connection( HTTP proxy 
).

Can we make redirectionStrategy to only make HTTP call even the call is https..

Thanks,
Aparna


Re: Handling Url's redirection using Httpclient

2015-02-10 Thread Bhowmik, Bindul
Hello,

On Tue, Feb 10, 2015 at 5:35 AM, gdrsantosh gdrsant...@gmail.com 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: httpclient-users-unsubscr...@hc.apache.org
 For additional commands, e-mail: httpclient-users-h...@hc.apache.org


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



Handling Url's redirection using Httpclient

2015-02-10 Thread gdrsantosh
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-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org