-
1. Re: HttpSession, Seam SessionContext and bijection
gavin.king Feb 20, 2006 10:46 AM (in response to sunfire)Interesting problem.
There is a question I have been wrestling with about whether Seam should make its contextual data directly available in HttpSession and HttpRequest attributes with the same name as the context variable, or whether it should keep stuff separate as it does presently (as you can see).
I think your usecase is quite reasonable; we need to allow people to set up some variables in a servlet filter.
For now, a (very) hacky temporary workaround is to use:session.setAttribute( ScopeType.SESSION.getPrefix() + '$' + "loggedInUser", user );
Please complain about this problem in JIRA, and I will give it some more thought. TIA -
2. Re: HttpSession, Seam SessionContext and bijection
sunfire Feb 20, 2006 11:16 AM (in response to sunfire)Thanks alot for the quick response! I appreciate it very much! :)
http://jira.jboss.com/jira/browse/JBSEAM-138 -
3. Re: HttpSession, Seam SessionContext and bijection
starksm64 Feb 20, 2006 3:18 PM (in response to sunfire)My view is that scope is an aspect that should not be explicitly encoded in an application. We need the jboss microcontainer metdata repository notion (http://wiki.jboss.org/wiki/Wiki.jsp?page=JBoss5RepositoryClasses, http://www.jboss.com/index.html?module=bb&op=viewtopic&t=73653) woven throughout the jboss layers.
The potential point of conflict is whether use of a standard legacy accessor like HttpServletRequest.getParameter("user.home") should suddenly be treated as a heirarchical variable that can be overriden by an thread local aspect, as well as have a default value coming from less dynamic scopes (deployment configuration, system property, server defaults, admin domain defaults, etc.). -
4. Re: HttpSession, Seam SessionContext and bijection
muckwarrior Jun 19, 2006 1:50 PM (in response to sunfire)I see from JIRA that this issue has been resolved.
Can somone tell me the correct way to make an object directly available to the Http Session so that it can be accessed by a Servlet filter?
Ive tried:@Out(value="loggedInUser", scope=ScopeType.SESSION) private User loggedInUser;
And in my servlet:user = (User)req.getSession().getAttribute("loggedInUser");
...which returns null. Should this work? -
5. Re: HttpSession, Seam SessionContext and bijection
gavin.king Jun 19, 2006 2:38 PM (in response to sunfire)Yes, this should work. (And I'm pretty sure it does. Step through Seam code in your debugger to confirm for yourself.)