[ 
http://issues.apache.org/jira/browse/WICKET-151?page=comments#action_12457053 ] 
            
Johan Compagner commented on WICKET-151:
----------------------------------------

the use case i see is a bit different.
There are users wants to have a fixed locale and not one from the default 
request
But that again can be overridden by preferences or something mid session.

This is very hard to do currently.

You can't do it in the constructor because we will override it again with 
setLocale
and when we call setLocale after construction they don't know that that is a 
call they don't want (locale from the request)
So for this case you have to override setLocale (that is then a NOP)
and introduce a setLocaleThatSticks method that they call them selfs.

Thats why i am still +1 (or is it +0.5 :) for us supplying the locale in the 
constructor.
But i think supplying the Request in the constructor is maybe even better..
Then they can configure there session exactly as the want. (ofcourse they can 
already do that outside of the session (ISessionFactory)
But maybe doing that inside the session you have more control (private fields 
setting and so on)
And we do then in the base session class:

setLocale(request.getLocale())

Then we set it once and then they can configure it like they want. 

> set session locale when constructing session object
> ---------------------------------------------------
>
>                 Key: WICKET-151
>                 URL: http://issues.apache.org/jira/browse/WICKET-151
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 2.0, 1.3
>            Reporter: Eelco Hillenius
>         Assigned To: Eelco Hillenius
>             Fix For: 2.0, 1.3
>
>
> Currently, we create the session objects like this:
> WebApplication#getSession:
> if (session == null)
> {
>       // Create session using session factory
>       session = getSessionFactory().newSession(request);
>       // Set the client Locale for this session
>       session.setLocale(request.getLocale());
> What I propose is to change the constructor from Session/ WebSession to take 
> in a Locale parameter as well. That would make it possible for custom session 
> classes to fix the locale by setting it in the constructor. Now that is only 
> possible by overriding Session#getLocale

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to