You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Juanjo <ju...@telefonica.net> on 2009/11/10 08:48:03 UTC
redirection in 4.0
Hi,
In windows using tomcat 6.0 and jdk 1.6, my program runs properly. It
connect to a website by post, sending parameters, that return a 302. Then,
It reads the Location head an makes a Get call.
When I deploy this program in linux with tomcat 5, the location head
returns the home url, not the right one.
This is the code:
HttpClient client = new DefaultHttpClient();
HttpPost req = new HttpPost(http://www.theweb.com);
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
formparams.add(new BasicNameValuePair("aaa","sss"));
...
UrlEncodedFormEntity param = new UrlEncodedFormEntity(formparams);
req.setEntity(param)
HttpResponse res = client.execute(req)
entity =res.getEntity();
Header loc = res.getFirstHeader("Location");
....
Another program that do the same but no redirection and using
BasicResponseHandler runs properly in both systems.
Please help,
Tanks
Juanjo