You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johan Cwiklinski <jo...@ajlsm.com> on 2011/01/07 09:03:43 UTC

i18n cookies storing path

Hello,

I'm currently working on i18n for our apps. I've put on the pages a
simple form with a select element for useres to change language
themselves, sending à 'locale' attribute in the URL.

Doing that, I had to enable language storage in a session
(store-in-session and create-session true) or in a cookie
(store-in-cookie true).

Using session storage makes things work well, but I'm unsure creating a
session only for a language is really needed, I guess that is more
costly than a simple cookie.

Using cookies does not work as I've excpected, since cookies stores
paths : I've a cokkie for '/myapp/' and another one for
'/myapp/functions/'. Both these path require i18n, but since there is
two different cookies, only one gets changed :(

We use cocoon 2.1.10 ; but it does not seems there are changes in the
relevant classes in 2.1.11.

So, my questions:
- is using a session so costly when it's no really needed? Some parts of
our app already require a session ; but others don't (static pages for
example).
- is there a way to make cookies not to store paths? I've not see how in
the doc or in the code :/

Thank you.

Regards,
Johan

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


Re: i18n cookies storing path

Posted by Johan Cwiklinski <jo...@ajlsm.com>.
Hello Christopher,

Le 07/01/2011 18:02, Christopher Schultz a écrit :
> Johan,
> 
> On 1/7/2011 5:45 AM, Johan Cwiklinski wrote:
>> Le 07/01/2011 11:24, Laurent Medioni a écrit :
>>> Strictly match, at the beginning of the pipeline, "" (or "/", I never remember...) and call the LocaleAction only there. Then end the matcher just after without response.
>>> This will work if your users always start browsing your application through ".../myapp/", typically just after login as a homepage.
>>>
>>> Now if you cannot be sure of this then, yes, something similar to the proposed patch in COCOON-1592 will enable you to set a "root" cookie from any subpath...
> 
>> I cannot be sure where users will start browsing unfortunately. I'll
>> take a look at the proposed patch ; thank you for the clarifications :)
> 
> If you're willing to write a bit of Java code, you can do this easily
> using a "servlet filter".

I was not aware of this possibility ; I'll take a look.

Thank you for the tip!

> 
> -chris

Best regards,
Johan


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


Re: i18n cookies storing path

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Johan,

On 1/7/2011 5:45 AM, Johan Cwiklinski wrote:
> Le 07/01/2011 11:24, Laurent Medioni a écrit :
>> Strictly match, at the beginning of the pipeline, "" (or "/", I never remember...) and call the LocaleAction only there. Then end the matcher just after without response.
>> This will work if your users always start browsing your application through ".../myapp/", typically just after login as a homepage.
>>
>> Now if you cannot be sure of this then, yes, something similar to the proposed patch in COCOON-1592 will enable you to set a "root" cookie from any subpath...
> 
> I cannot be sure where users will start browsing unfortunately. I'll
> take a look at the proposed patch ; thank you for the clarifications :)

If you're willing to write a bit of Java code, you can do this easily
using a "servlet filter".

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0nRxYACgkQ9CaO5/Lv0PAt3QCbBb3cyvUN51n2kPb3QD01GgK7
9yMAoIYcJONG4tZg36bhuun2Tcz3HpbT
=o9yo
-----END PGP SIGNATURE-----

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


Re: i18n cookies storing path

Posted by Johan Cwiklinski <jo...@ajlsm.com>.
Le 07/01/2011 11:24, Laurent Medioni a écrit :
> Strictly match, at the beginning of the pipeline, "" (or "/", I never remember...) and call the LocaleAction only there. Then end the matcher just after without response.
> This will work if your users always start browsing your application through ".../myapp/", typically just after login as a homepage.
> 
> Now if you cannot be sure of this then, yes, something similar to the proposed patch in COCOON-1592 will enable you to set a "root" cookie from any subpath...

I cannot be sure where users will start browsing unfortunately. I'll
take a look at the proposed patch ; thank you for the clarifications :)

> 
> Laurent

Best regards,
Johan

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


RE: i18n cookies storing path

Posted by Laurent Medioni <lm...@odyssey-group.com>.
Strictly match, at the beginning of the pipeline, "" (or "/", I never remember...) and call the LocaleAction only there. Then end the matcher just after without response.
This will work if your users always start browsing your application through ".../myapp/", typically just after login as a homepage.

Now if you cannot be sure of this then, yes, something similar to the proposed patch in COCOON-1592 will enable you to set a "root" cookie from any subpath...

Laurent

____________________________________________________________

• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.

Re: i18n cookies storing path

Posted by Johan Cwiklinski <jo...@ajlsm.com>.
Hello,

Le 07/01/2011 09:59, Laurent Medioni a écrit :
> Hi,
> You should only set the cookie when responding to "/myapp/" level and then it will be available to all subpathes (for the same domain of course). 

Yes, but I don't know how to achieve that.
Cookie is setted when calling the locale action, as far as I can
understand ; it does not seems possible to tell the action not to create
a cookie, or set a specific path.

I've found a similar issue that has already been reported (it's pretty
old tought):
https://issues.apache.org/jira/browse/COCOON-1592

Regards,
Johan

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


RE: i18n cookies storing path

Posted by Laurent Medioni <lm...@odyssey-group.com>.
Hi,
You should only set the cookie when responding to "/myapp/" level and then it will be available to all subpathes (for the same domain of course). 

Laurent

____________________________________________________________

• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.