You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jorge Gallardo <jo...@gmail.com> on 2011/09/16 20:41:26 UTC

Re: Localized mount points for BookmarkablePages?

Hi people,

What is the best way to achieve this with Wicket 1.5? Still using the same
approach?

Thanks!
JG

On Thu, Dec 23, 2010 at 7:50 AM, Bas Gooren <ba...@iswd.nl> wrote:

> I think in wicket 1.4.x this is only possible with a custom mount point; In
> other words:
>
> Override/implement a version of bookmarkable page handling which takes into
> accoun the locale.
> Have a look at BookmarkablePageRequestTargetU**rlCodingStrategy. You could
> implement this class, overriding it's matches() method to match the mount
> path and the locale. For encoding and decoding you should be able to use the
> bookmarkable parts available in wicket.
>
> PageWithLocaleUrlCodingStrateg**y extends BookmarkablePageRequestTargetU**rlCodingStrategy
> {
>   Locale locale;
>
>   // constructors of BPRTUCS with added Locale param
>
>   matches( IRequestTarget target ) {
>       return super.matches(target) && getSession().getLocale().**
> equals(this.locale);
>   }
> }
>
> You can then mount like this (in application.init):
> mount( new PageWithLocaleUrlCodingStrateg**y( "General", new
> Locale("en","US"), MainPage.class ) );
> etc
>
> Hope this helps!
>
> Bas
>
> ----- Original Message ----- From: ""Thomas Götz"" <to...@richmountain.de>
> To: <us...@wicket.apache.org>
> Sent: Thursday, December 23, 2010 2:36 PM
> Subject: Re: Localized mount points for BookmarkablePages?
>
>
>
>  Ok, thanks for that hint. But: if I mount the page using the method you
>> described, which mount name will be taken when referencing the page via a
>> BookmarkablePageLink? What I want to achieve is that if the current
>> user/session is set to locale "GERMAN" e.g., then all BookmarkablePageLinks
>> should be rendered with the german mount name, got my point?
>>
>> Cheers,
>>  -Tom
>>
>>
>>  ----- Ursprüngliche Nachricht -----
>>> Von: Hans Lesmeister
>>> Gesendet: 23.12.10 13:05 Uhr
>>> An: users@wicket.apache.org
>>> Betreff: Re: Localized mount points for BookmarkablePages?
>>>
>>> Hi, you van pass a list with alternates to the mount-annotation. Same
>>> can be done on mounting programmatically.
>>>
>>> Regards Hans
>>>
>>>
>>>
>>> Am 23.12.2010 um 12:29 schrieb Thomas Götz <to...@richmountain.de>:
>>>
>>> > Hi,
>>> >
>>> > is it possible to have localized mount points for BookmarkablePages?
>>> >
>>> > Example:
>>> > I have a BookmarkablePage GeneralPage.java which should be available
>>> > under
>>> > http://my.domain.com/General and
>>> > http://my.domain.com/Allgemein (german)
>>> >
>>> > ... depending on the current locale. Is this possible? If yes, could
>>> > someone
>>> > point me into the right direction?
>>> >
>>> > Cheers,
>>> > -Tom
>>> >
>>> >
>>> >
>>> > ------------------------------**------------------------------**
>>> ---------
>>> > To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> > For additional commands, e-mail: users-help@wicket.apache.org
>>> >
>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Jorge Gallardo
----------------------------------------
jorgeagallardo@gmail.com

Re: Localized mount points for BookmarkablePages?

Posted by Igor Vaynberg <ig...@gmail.com>.
there is an example of this in the new wicket-examples under request
mapper examples.

-igor

On Fri, Sep 16, 2011 at 11:41 AM, Jorge Gallardo
<jo...@gmail.com> wrote:
> Hi people,
>
> What is the best way to achieve this with Wicket 1.5? Still using the same
> approach?
>
> Thanks!
> JG
>
> On Thu, Dec 23, 2010 at 7:50 AM, Bas Gooren <ba...@iswd.nl> wrote:
>
>> I think in wicket 1.4.x this is only possible with a custom mount point; In
>> other words:
>>
>> Override/implement a version of bookmarkable page handling which takes into
>> accoun the locale.
>> Have a look at BookmarkablePageRequestTargetU**rlCodingStrategy. You could
>> implement this class, overriding it's matches() method to match the mount
>> path and the locale. For encoding and decoding you should be able to use the
>> bookmarkable parts available in wicket.
>>
>> PageWithLocaleUrlCodingStrateg**y extends BookmarkablePageRequestTargetU**rlCodingStrategy
>> {
>>   Locale locale;
>>
>>   // constructors of BPRTUCS with added Locale param
>>
>>   matches( IRequestTarget target ) {
>>       return super.matches(target) && getSession().getLocale().**
>> equals(this.locale);
>>   }
>> }
>>
>> You can then mount like this (in application.init):
>> mount( new PageWithLocaleUrlCodingStrateg**y( "General", new
>> Locale("en","US"), MainPage.class ) );
>> etc
>>
>> Hope this helps!
>>
>> Bas
>>
>> ----- Original Message ----- From: ""Thomas Götz"" <to...@richmountain.de>
>> To: <us...@wicket.apache.org>
>> Sent: Thursday, December 23, 2010 2:36 PM
>> Subject: Re: Localized mount points for BookmarkablePages?
>>
>>
>>
>>  Ok, thanks for that hint. But: if I mount the page using the method you
>>> described, which mount name will be taken when referencing the page via a
>>> BookmarkablePageLink? What I want to achieve is that if the current
>>> user/session is set to locale "GERMAN" e.g., then all BookmarkablePageLinks
>>> should be rendered with the german mount name, got my point?
>>>
>>> Cheers,
>>>  -Tom
>>>
>>>
>>>  ----- Ursprüngliche Nachricht -----
>>>> Von: Hans Lesmeister
>>>> Gesendet: 23.12.10 13:05 Uhr
>>>> An: users@wicket.apache.org
>>>> Betreff: Re: Localized mount points for BookmarkablePages?
>>>>
>>>> Hi, you van pass a list with alternates to the mount-annotation. Same
>>>> can be done on mounting programmatically.
>>>>
>>>> Regards Hans
>>>>
>>>>
>>>>
>>>> Am 23.12.2010 um 12:29 schrieb Thomas Götz <to...@richmountain.de>:
>>>>
>>>> > Hi,
>>>> >
>>>> > is it possible to have localized mount points for BookmarkablePages?
>>>> >
>>>> > Example:
>>>> > I have a BookmarkablePage GeneralPage.java which should be available
>>>> > under
>>>> > http://my.domain.com/General and
>>>> > http://my.domain.com/Allgemein (german)
>>>> >
>>>> > ... depending on the current locale. Is this possible? If yes, could
>>>> > someone
>>>> > point me into the right direction?
>>>> >
>>>> > Cheers,
>>>> > -Tom
>>>> >
>>>> >
>>>> >
>>>> > ------------------------------**------------------------------**
>>>> ---------
>>>> > To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>> > For additional commands, e-mail: users-help@wicket.apache.org
>>>> >
>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Jorge Gallardo
> ----------------------------------------
> jorgeagallardo@gmail.com
>

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