-
1. Re: @Startup and user session
damianharvey Aug 26, 2007 5:15 AM (in response to mnrz)Outject it into the session scope when you perform the login.
@Out(scope=ScopeType.SESSION) UserSettings userSettings;
Cheers,
Damian. -
2. Re: @Startup and user session
mnrz Aug 26, 2007 5:23 AM (in response to mnrz)"damianharvey" wrote:
Outject it into the session scope when you perform the login.
but outject it from where? there is another component that performs authentication named "Authenticator" when login performed and the user logged in, at the same time, the userSettings doesn't exist to be outjected.
my problem is that I want this component being loaded just right after logging in. -
3. Re: @Startup and user session
matt.drees Aug 26, 2007 3:27 PM (in response to mnrz)Probably what I would do is put an @Observer("org.jboss.seam.postAuthenticate") method in your userSettings component.
-
4. Re: @Startup and user session
mnrz Aug 27, 2007 3:51 AM (in response to mnrz)"matt.drees" wrote:
Probably what I would do is put an @Observer("org.jboss.seam.postAuthenticate") method in your userSettings component.
thanks matt.drees, it worked fine, but another problem came about, there are three other component which depend on this unique component method. In other words, after invoking this method some variable will be outjected so other comp. will inject those variables.
how to manage this? -
5. Re: @Startup and user session
matt.drees Aug 27, 2007 4:19 PM (in response to mnrz)I'm not sure what you mean.
-
6. Re: @Startup and user session
mnrz Aug 28, 2007 1:04 AM (in response to mnrz)"matt.drees" wrote:
I'm not sure what you mean.
well, let me explain more. when a user logged in, the application should find which fields and categories he is allowed to search so I defined an action in which a Map of accessible fields will be created. this map is creating after authenticating the user (using the solution you suggest: @Observer)
now other actions like Exporting, query builder , etc need to work only with authorized fields and these are presented by the same map. I need to notify them as well to initialize themself. I can use Events.instance().raiseEvent to notify the other actions but I think this is not good. what do you think? -
7. Re: @Startup and user session
matt.drees Aug 28, 2007 11:18 AM (in response to mnrz)Why do you think raiseEvent is bad? That's probably what I would use. If the second set of initializers depend on contextual variables outjected from the first initializer, I would probably use @RaiseEvent instead of Events.instance.raiseEvent, because the second approach won't do outjection before raising the event, and the first approach will. (I think; haven't tested, but from looking at seam src, it should)
-
8. Re: @Startup and user session
mnrz Aug 28, 2007 11:38 AM (in response to mnrz)well, I didn't know about @RaiseEvent, I will try it
the thing that make me reluctant to use Event...raseEvent is that, in my opinion, if you use this too much it will make your application complex and hard to understand and debug it in future
anyway, thank you very much for your help, currently I am using the same Events...raseEvent() but I will take a look at @RaiseEvent