Hi Sushil,
I'm not sure exactly what's happening, but you might want to try
responding to the first redirect with a GET.
Mike
On Apr 7, 2005 7:08 PM, Sushil Sureka <[EMAIL PROTECTED]> wrote:
> Hi,
> I am trying to connect to https site and post userid/password to
> authenticate and then finally download a html page. The html page is
> served from a http link. So basically only userid/password page is
> https and rest is http. (I think also there is some redirection going
> on after you login.)
> The server is running on weblogic. Anyway, I am running into problem
> wher I keep getting redirected to security page. For example in my
> first attempt (code snippet is below)
>
> PostMethod post = new PostMethod("https://localhost.com");
> post.addParameter("login", "MYUSER");
> post.addParameter("password", "XXXX");
> post.addParameter("submit", "Submit");*/
> post.setFollowRedirects(true);
> post.setStrictMode(false);
> HttpClient client = new HttpClient();
> int status = client.executeMethod(post);
>
> I get This document you requested has moved temporarily.</p>
> <p>It's now at <a
> href="https://localhost:7002/security/loginAction.do;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&submit=Submit&login=MYUSER">https://localhost:7002/security/loginAction.do;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&submit=Submit&login=MYUSER</a>.</p>
> </body></html>
>
> Then I tried to follow the redirect
> Header locationHeader = post.getResponseHeader("location");
> if (locationHeader != null) {
> System.out.println("redirecting to " + redirectLocation);
> post = new PostMethod(redirectLocation);
> status = client.executeMethod(post);
>
> Again I get redirected to same url
> https://localhost:7002/security/loginAction.do?password=XXX&submit=Submit&login=MYUSER
> ( this time around without jsession id)
>
> But if I disable the HTTPS on server, I can work fine. Is there any
> idea why this might be happening. The server does create a cookie
> after you login but I am not even getting to that point.
> thanks
> Sushil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]