Thread local FTW ... make a simple class with public static User
getCurrentUser() { return threadLocal.get(); } .. set the user in there after
access is granted to the event in your interceptor.
No more passing user all the way down to every call etc, it's always just right
there in a static method. Use of a ThreadLocal here is almost too good to be
true, things normally aren't this easy.
From: Poitras Christian [mailto:[email protected]]
Sent: Monday, June 08, 2009 10:39 AM
To: 'Stripes Users List'
Subject: Re: [Stripes-users] access session from a TypeConverter
Another way would be to link session to a ThreadLocal inside an interceptor.
Christian
________________________________
From: Daniil Sosonkin [mailto:[email protected]]
Sent: Monday, June 08, 2009 10:30 AM
To: Stripes Users List
Subject: Re: [Stripes-users] access session from a TypeConverter
This is for a trading application and my type converter converts a String that
represents a ticker symbol into a Quote object. Due to security requirements,
access control privileges, etc... I need to know some information about a user
currently logged in before a Quote can be obtained from the provider. All that
information is stored in the session.
Poatris - thank you for the recommendation. Unfortunately we don't use Spring
anywhere and as a result I don't understand the code.
Still looking for a solution other than having String converted into Quote
object in the ActionBeans. TypeConverter comes in very handy.
Sincerely,
Daniil
Richard Hauswald wrote:
What do you want to do in a type converter what needs a session?
On Fri, Jun 5, 2009 at 9:34 PM, Daniil
Sosonkin<[email protected]><mailto:[email protected]> wrote:
Here's a good one. I have a TypeConverter that needs to access some
variables for the current session. So far, I haven't found a way of doing
that via library. I could be missing something. Can someone point me in the
right direction?
Daniil
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Stripes-users mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Stripes-users mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users