Hey all,

Got a small problem with Cookies!

What happens is:

1 User logs in using the LoginServlet

2 The LoginServlet sets a Cookies and forwards the request to the
j_security_check i.e. Container Managed Auth.

    Cookie cookie = new Cookie(name, value);
    cookie.setPath("/");
    cookie.setMaxAge(30 * 24 * 60 * 60); // 30 days
    response.addCookie(cookie);

    String req = request.getContextPath() + "/" + authURL + "?j_username=" +
                 RequestUtils.encodeURL(username) + "&j_password=" +
                 RequestUtils.encodeURL(encryptedPassword);
    response.sendRedirect(response.encodeRedirectURL(req));


3 CMA loads the user principle and the request it forwarded to /welcome.do
4 The SingleSignonFilter runs but is unable to find the cookie set in step 2
above and displays error page.
5 If I press refresh button, SingleSignonFilter can now find the cookie and
everthing works!

The above is much like what is found in struts-resume found on sf.net

My question is, when does the cookie get sent to the browser?

Is it after Step 2 when the LoginServlet does the response.sendRedirect()
or
Is it after Step 4 when the SingleSignonFilter displays the error page


My second question:

What is the best way to remove a cookie?
Setting the max-age to zero doesn't seem to work for me!

Tnx in advance.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to