It may sound weird, but will do the job perfectly:

At first request you read the cookies and put a flag into session,
that you already read them:

Action (best in a base action of course):
execute(HttpServlet req,....

  HttpSession session = req.getSession();
  if (session.getAttribute(MY_COOKIE_FLAG)==null){
      readCookiesAndCustomize(req);
      session.setAttribute(MY_COOKIE_FLAG,Boolean.TRUE);
  }

regards
Leon

On 1/11/07, Pierre Thibaudeau <[EMAIL PROTECTED]> wrote:
I would like to read the cookies at the very beginning of a user's session,
in order (for example) to customize the presentation according to his
preferences from his previous sessions.

I imagine that overriding the sessionCreated() method of an
HttpSessionListener would be ideal for my purpose.  The problem is that the
sessionCreated() method provides only an HttpSessionEvent (corresponding to
the creation of the session).  What I need is to access an HttpRequest in
order to getCookies().  Surely if the session was created, some HttpRequest
must have been issued in the first place, but how do I get hold of this
request?

Maybe my problem is that I am not looking at the appropriate Listener.  But
I would rather not listen to every single request when I only need to read
cookies once at the beginning of a session!

Suggestions?



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

Reply via email to