Re: [Stripes-users] Locale Picker and request interceptor

2011-03-18 Thread FosPat
Oscar Westra van Holthe - Kind vient de nous annoncer :
 On 24-09-2009 at 16:45, Lionel wrote:
 Hi all !
 
 I would like to set the user locale as a thread local variable from an 
 interceptor (based on the user account) and get this value from a custom 
 LocalePicker.
 But it seems that the LocalePicker.getLocale() is called before 
 interceptors.
 Is there some way to configurer the execution order to have muy interceptor 
 called before the LocalePicker ?

 No. But you can do the following:
 1. Create a custom ActionBeanContext that retreives the user account
information based on either request.getUserPrincipal(), other request
data, or the session. Put your variable in a request attribute.
Configure the StripesFilter to use this class directly or put it in an
extension package.
 2. Create a custom LocalePicker (subclass the DefaultLocalePicker for
example). It get's the request, so you can access your variable to
determine the locale to use.
Configuration is analogous to point 1.


 Oscar

Late answer, but I faced the same issue with a new application.
The Locale is in dabatabse on the user, but I can't load the user as 
Stripersist is not initialized yet when MyLocalePicker is called...




--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Locale Picker and request interceptor

2011-03-18 Thread Nikolaos Giannopoulos

FosPat wrote:

Oscar Westra van Holthe - Kind vient de nous annoncer :
  

On 24-09-2009 at 16:45, Lionel wrote:


Hi all !

I would like to set the user locale as a thread local variable from an 
interceptor (based on the user account) and get this value from a custom 
LocalePicker.
But it seems that the LocalePicker.getLocale() is called before 
interceptors.
Is there some way to configurer the execution order to have muy interceptor 
called before the LocalePicker ?
  

No. But you can do the following:
1. Create a custom ActionBeanContext that retreives the user account
   information based on either request.getUserPrincipal(), other request
   data, or the session. Put your variable in a request attribute.
   Configure the StripesFilter to use this class directly or put it in an
   extension package.
2. Create a custom LocalePicker (subclass the DefaultLocalePicker for
   example). It get's the request, so you can access your variable to
   determine the locale to use.
   Configuration is analogous to point 1.


Oscar



Late answer, but I faced the same issue with a new application.
The Locale is in dabatabse on the user, but I can't load the user as 
Stripersist is not initialized yet when MyLocalePicker is called...
  

FosPat,

I imagine you meant Late question.  Correct?  If so, let me offer a 
3rd option on at least how we handle this which may or may not be useful 
to you or offer you other ideas when a DB is involved.


Until the user logs in for the 1st time we need to determine the users 
locale in a way that does not involve the DB.  We use UrlRewriteFilter 
for many of our requirements involving domains but one nice feature it 
has is to write a class that does anything.  In our PreProcessFilter 
class we go through a series of checks to determine the users locale 
i.e. we start with is there a locale cookie, otherwise check the accept 
langs on the request, etc... and once its determined its added on the 
request and a cookie is created if it wasn't present.  We then have a 
custom locale picker that simply looks for and pulls this locale from 
the request and provides it to Stripes.


Once the user logs or is logged in their preferred or profile locale 
gets set as a locale cookie (unless it already exists and matches the 
existing locale cookie) and everything else behaves the same.  Also if 
they ever clear their cookies the above process will reset it from their 
profile.


HTH,

--Nikolaos
--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Locale Picker and request interceptor

2009-09-30 Thread Oscar Westra van Holthe - Kind
On 24-09-2009 at 16:45, Lionel wrote:
 Hi all !
 
 I would like to set the user locale as a thread local variable from an 
 interceptor (based on the user account) and get this value from a custom 
 LocalePicker.
 But it seems that the LocalePicker.getLocale() is called before 
 interceptors.
 Is there some way to configurer the execution order to have muy interceptor 
 called before the LocalePicker ?

No. But you can do the following:
1. Create a custom ActionBeanContext that retreives the user account
   information based on either request.getUserPrincipal(), other request
   data, or the session. Put your variable in a request attribute.
   Configure the StripesFilter to use this class directly or put it in an
   extension package.
2. Create a custom LocalePicker (subclass the DefaultLocalePicker for
   example). It get's the request, so you can access your variable to
   determine the locale to use.
   Configuration is analogous to point 1.


Oscar

-- 
   ,-_
  /() ) Oscar Westra van Holthe - Kind  http://www.xs4all.nl/~kindop/
 (__ (
=/  ()  DRM manages access in the same way that a jail manages freedom.

--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] Locale Picker and request interceptor

2009-09-24 Thread Lionel
Hi all !

I would like to set the user locale as a thread local variable from an 
interceptor (based on the user account) and get this value from a custom 
LocalePicker.
But it seems that the LocalePicker.getLocale() is called before 
interceptors.
Is there some way to configurer the execution order to have muy interceptor 
called before the LocalePicker ?

Thanks.
Lionel 




--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users