tags:

views:

46

answers:

1

Hello, 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 DefaultHttpClient();
HttpResponse response = httpclient.execute(httpPost);

Thanks, Erik

+1  A: 

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: http://stackoverflow.com/questions/1352949/preventing-httpclient-4-from-following-redirect.

CommonsWare