I have the Seam session-scoped component, CustomIdentity which overrides the standard Seam Identity (also session-scoped). The extended CustomIdentity has a property
@Out(required=false, scope=ScopeType.SESSION)private User user
In the overriden login() I define a User object, populated with information from the Principal of the HttpServletRequest. In the first request in the application the User object is outjected as expected in SESSION scope. In the second request, though, the User object has vanished from the Session, and when I visit a page that Injects it, I get an exception.
My question is when exactly the component is outjected:
user
)?And about the required
attribute:
null
, is the already outjected User going to be removed from Session scope?Cheers!
To your first question: the component is oujected after each and every method of CustomIdentity
. Take a look at the corresponding Seam source code org.jboss.seam.core.BijectionInterceptor
(Seam 2.2.0). Bijection takes place at component, i.e., class, level.
To your second question: every time a request to CustomIdentity
finishes, the value of your field is outjected. If you use the outjection property require=false
, the user
that is currently outjected in your session context may be overridden by null
.