users@glassfish.java.net

Re: Get a session object after login with Realm

From: <glassfish_at_javadesktop.org>
Date: Wed, 18 Mar 2009 21:09:55 PDT

I've also been told that getting the session is possible under certain circumstances using

[code]
HttpSession s = null;
try {
   HttpServletRequest r = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
   if (r != null) {
      s = r.getSession(false);
   }
} catch (PolicyContextException ex) {
      LOG.log(Level.SEVERE, null, ex);
}
[/code]

but my tests never return a session that is non-null. I'm using HTTP Basic authentication.

Can anyone comment on their experience acquiring the session in this mannger, via PolicyContext?

Thanks.
[Message sent by forum member 'ae6rt' (ae6rt)]

http://forums.java.net/jive/thread.jspa?messageID=337845