hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Puneet Lakhina" <puneet.lakh...@gmail.com>
Subject Re: Getting response from redirected page....
Date Fri, 20 Jun 2008 13:30:44 GMT
On Fri, Jun 20, 2008 at 18:20, raju <raju_ak@hotmail.com> wrote:

>
> 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 .
>

What exactly is the problem? Do you get an exception? If yes then what is
it?

>
> 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
>
>


-- 
Puneet
http://sahyog.blogspot.com/
Latest Post: javac -g

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message