开发者

How do I see which URL I was redirected to?

开发者 https://www.devze.com 2022-12-17 08:51 出处:网络
I\'m trying to figure out which URL I was directed to. I\'m using the following code and it seems to hide the redirect.

I'm trying to figure out which URL I was directed to. I'm using the following code and it seems to hide the redirect.

HttpPost httpPost = new HttpPost(url);
DefaultHttpClient httpclient = new DefaultH开发者_开发问答ttpClient();
HttpResponse response = httpclient.execute(httpPost);

Thanks, Erik


HttpClient automatically follows redirects. The only way I know of to know what redirects are going on is to introduce a RedirectHandler, as is discussed in a previous SO entry: Preventing HttpClient 4 from following redirect.

0

精彩评论

暂无评论...
验证码 换一张
取 消