hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raju <raju...@hotmail.com>
Subject Getting response from redirected page....
Date Fri, 20 Jun 2008 12:50:41 GMT

Hi,

I am using HttpClient PostMethod to post login name value pair credentials
.This aspect is working fine.
On succesfull login its redirected to a page(jsp) which lists al particular
items available.

I need to read the response of this redirected page to get hold of an
id.Though i tried using setFollowRedirect true approach i am not able to a
handle to the correct response.

First Step:Logon
----------
PostMethod post= new PostMethod("/servlets/Logon");
userid = new NameValuePair("userName", userid);
password = new NameValuePair("userPassword",pwd);
post.setRequestBody(new NameValuePair[] { userid, password
});client.executeMethod(authpost);

Its OK

Second Step:Redirected Page response
-------------
 Header header = post.getResponseHeader("location");
String uri = header.getValue();
 GetMethod redirect = new GetMethod(uri);
 client.executeMethod(redirect);
 System.out.println(redirect.getResponseBodyAsString());

Problem is with this .

Regards
Raj
-- 
View this message in context: http://www.nabble.com/Getting-response-from-redirected-page....-tp18028897p18028897.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Mime
View raw message