You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by immutability <de...@bielik.org> on 2009/05/21 21:26:42 UTC

[T5.1] Locale - possible to revert to cookies?

Hi everyone, now that Tapestry 5.1.0.5 is encoding the selected locale in URL
rather than using cookie for this purpose, is it still possible to somehow
configure Tapestry to use cookies as in 5.0.x? This way worked better for
our application (i.e. being "hidden" from the URL and more "permanent" with
cookie expiration set to a few days). 

Or is the only way to make it work this way putting together some custom
code to do this (i.e. store the setting in a cookie, or perhaps even as some
user-specific setting in a database)?

Thanks,
Rado
-- 
View this message in context: http://www.nabble.com/-T5.1--Locale---possible-to-revert-to-cookies--tp23659027p23659027.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.1] Locale - possible to revert to cookies?

Posted by immutability <de...@bielik.org>.
Alright, for anyone who may need this, I did the following to re-enable the
cookie-based locale in Tapestry 5.1.0.5:

- provided a separate implementation of PersistentLocale service, copying
Tapestry 5.0.18 code, since this interface hasn't changed
- provided a separate implementation of LocalizationSetter service, but this
interface has changed in 5.1, but I only needed to edit one of the methods
in the original 5.1.0.5 code of the LocalizationSetterImpl (namely the
setLocaleFromLocaleName method)
- did the binding of the 2 services in my AppModule, and contributed alias
to ensure that Tapestry picks up my implementations rather than the built-in
ones using Automatic Dependency Resolution
- turned off SymbolConstants.ENCODE_LOCALE_INTO_PATH setting in
contributeApplicationDefaults - this will ensure that tapestry-generated
URLs will not have the locale part embedded

If anyone needs more detailed instructions on this, I can create a how-to.

Rado



immutability wrote:
> 
> The new URL-based language switching is also causing issues with the way
> Tapestry-Acegi handles the redirect to the login page once a session
> expires. If a user switches to another language, let's say, Spanish,
> they'll end up on a page with "es" locale code embedded in the URL, e.g.
> /es/some/page. But if their session expires, Acegi will redirect them to
> the login page, ignoring the locale component of the URL, e.g. /index, and
> thus their language preference is lost. 
> 
> I guess it's not possible to revert to cookies easily in T5.1 now? Anyone
> has a workaround for the Tapestry-Acegi issue?
> 
> Thanks,
> Rado
> 
> 
> 
> immutability wrote:
>> 
>> Hi everyone, now that Tapestry 5.1.0.5 is encoding the selected locale in
>> URL rather than using cookie for this purpose, is it still possible to
>> somehow configure Tapestry to use cookies as in 5.0.x? This way worked
>> better for our application (i.e. being "hidden" from the URL and more
>> "permanent" with cookie expiration set to a few days). 
>> 
>> Or is the only way to make it work this way putting together some custom
>> code to do this (i.e. store the setting in a cookie, or perhaps even as
>> some user-specific setting in a database)?
>> 
>> Thanks,
>> Rado
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5.1--Locale---possible-to-revert-to-cookies--tp23659027p24090806.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.1] Locale - possible to revert to cookies?

Posted by immutability <de...@bielik.org>.
The new URL-based language switching is also causing issues with the way
Tapestry-Acegi handles the redirect to the login page once a session
expires. If a user switches to another language, let's say, Spanish, they'll
end up on a page with "es" locale code embedded in the URL, e.g.
/es/some/page. But if their session expires, Acegi will redirect them to the
login page, ignoring the locale component of the URL, e.g. /index, and thus
their language preference is lost. 

I guess it's not possible to revert to cookies easily in T5.1 now? Anyone
has a workaround for the Tapestry-Acegi issue?

Thanks,
Rado



immutability wrote:
> 
> Hi everyone, now that Tapestry 5.1.0.5 is encoding the selected locale in
> URL rather than using cookie for this purpose, is it still possible to
> somehow configure Tapestry to use cookies as in 5.0.x? This way worked
> better for our application (i.e. being "hidden" from the URL and more
> "permanent" with cookie expiration set to a few days). 
> 
> Or is the only way to make it work this way putting together some custom
> code to do this (i.e. store the setting in a cookie, or perhaps even as
> some user-specific setting in a database)?
> 
> Thanks,
> Rado
> 

-- 
View this message in context: http://www.nabble.com/-T5.1--Locale---possible-to-revert-to-cookies--tp23659027p24062150.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org