You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nicolas Tacheny <ni...@gmail.com> on 2012/09/19 12:47:10 UTC

Wicket 1.5 - How to configure link generated url?

I'm coding a wicket 1.5 application and I need to control the way url are rendered for security reason.

mountPage("xxx/yyy", Zzzz.class)

is excellent for that but I have a problem with url generated for link listener. For exemple, if I add the following link to my page:

add(new Link<Void>("link-login") {
  @Override
  public void onClick() {
    setResponsePage(LoginPage.class);
  }
});

I obtain the following generated markup:

<a wicket:id="link-login" href="./home?0-1.ILinkListener-accessMenu-link~login">Login</a>

Is there a way to configure the generated url (./home?0-1.ILinkListener-accessMenu-link~login)? At least, I would like to remove the ~ character.

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


Re: Wicket 1.5 - How to configure link generated url?

Posted by Nicolas Tacheny <ni...@gmail.com>.
Hallelujah!
Tx a lot.

On 19 Sep 2012, at 13:18, Martin Grigorov wrote:

> By default Wicket uses '-' as url-encoded version of the component
> path separator (':').
> Wicket uses '~' only if your component id has '-' in its name.
> So the easiest solution to avoid '~' is to not use '-' in the
> component ids. I.e. rename 'link-login' to 'linkLogin'.
> 
> On Wed, Sep 19, 2012 at 2:04 PM, Nicolas Tacheny
> <ni...@gmail.com> wrote:
>> Tx, it's ok with a BookmarkablePageLink but is there a way to configure that for Link in case I need to implement specifics behaviors in onClick?
>> 
>> It's a security constraint in the owner company. My web app will be behind a Web Application Firewall (apache module) in which there are rules disabling ~ in url.
>> 
>> 
>> 
>> On 19 Sep 2012, at 12:53, Martin Grigorov wrote:
>> 
>>> Hi,
>>> 
>>> You can use
>>> mountPage("login", LoginPage.class);
>>> add(new BookmarkablePageLink("link-login", LoginPage.class))
>>> 
>>> this will generate: /login.
>>> 
>>> Whay do you want to replace '~' ?
>>> 
>>> On Wed, Sep 19, 2012 at 1:47 PM, Nicolas Tacheny
>>> <ni...@gmail.com> wrote:
>>>> I'm coding a wicket 1.5 application and I need to control the way url are rendered for security reason.
>>>> 
>>>> mountPage("xxx/yyy", Zzzz.class)
>>>> 
>>>> is excellent for that but I have a problem with url generated for link listener. For exemple, if I add the following link to my page:
>>>> 
>>>> add(new Link<Void>("link-login") {
>>>> @Override
>>>> public void onClick() {
>>>>   setResponsePage(LoginPage.class);
>>>> }
>>>> });
>>>> 
>>>> I obtain the following generated markup:
>>>> 
>>>> <a wicket:id="link-login" href="./home?0-1.ILinkListener-accessMenu-link~login">Login</a>
>>>> 
>>>> Is there a way to configure the generated url (./home?0-1.ILinkListener-accessMenu-link~login)? At least, I would like to remove the ~ character.
>>>> 
>>>> Tx for replies
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Martin Grigorov
>>> jWeekend
>>> Training, Consulting, Development
>>> http://jWeekend.com
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
> 
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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


Re: Wicket 1.5 - How to configure link generated url?

Posted by Martin Grigorov <mg...@apache.org>.
By default Wicket uses '-' as url-encoded version of the component
path separator (':').
Wicket uses '~' only if your component id has '-' in its name.
So the easiest solution to avoid '~' is to not use '-' in the
component ids. I.e. rename 'link-login' to 'linkLogin'.

On Wed, Sep 19, 2012 at 2:04 PM, Nicolas Tacheny
<ni...@gmail.com> wrote:
> Tx, it's ok with a BookmarkablePageLink but is there a way to configure that for Link in case I need to implement specifics behaviors in onClick?
>
> It's a security constraint in the owner company. My web app will be behind a Web Application Firewall (apache module) in which there are rules disabling ~ in url.
>
>
>
> On 19 Sep 2012, at 12:53, Martin Grigorov wrote:
>
>> Hi,
>>
>> You can use
>> mountPage("login", LoginPage.class);
>> add(new BookmarkablePageLink("link-login", LoginPage.class))
>>
>> this will generate: /login.
>>
>> Whay do you want to replace '~' ?
>>
>> On Wed, Sep 19, 2012 at 1:47 PM, Nicolas Tacheny
>> <ni...@gmail.com> wrote:
>>> I'm coding a wicket 1.5 application and I need to control the way url are rendered for security reason.
>>>
>>> mountPage("xxx/yyy", Zzzz.class)
>>>
>>> is excellent for that but I have a problem with url generated for link listener. For exemple, if I add the following link to my page:
>>>
>>> add(new Link<Void>("link-login") {
>>>  @Override
>>>  public void onClick() {
>>>    setResponsePage(LoginPage.class);
>>>  }
>>> });
>>>
>>> I obtain the following generated markup:
>>>
>>> <a wicket:id="link-login" href="./home?0-1.ILinkListener-accessMenu-link~login">Login</a>
>>>
>>> Is there a way to configure the generated url (./home?0-1.ILinkListener-accessMenu-link~login)? At least, I would like to remove the ~ character.
>>>
>>> Tx for replies
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Wicket 1.5 - How to configure link generated url?

Posted by Nicolas Tacheny <ni...@gmail.com>.
Tx, it's ok with a BookmarkablePageLink but is there a way to configure that for Link in case I need to implement specifics behaviors in onClick?

It's a security constraint in the owner company. My web app will be behind a Web Application Firewall (apache module) in which there are rules disabling ~ in url.



On 19 Sep 2012, at 12:53, Martin Grigorov wrote:

> Hi,
> 
> You can use
> mountPage("login", LoginPage.class);
> add(new BookmarkablePageLink("link-login", LoginPage.class))
> 
> this will generate: /login.
> 
> Whay do you want to replace '~' ?
> 
> On Wed, Sep 19, 2012 at 1:47 PM, Nicolas Tacheny
> <ni...@gmail.com> wrote:
>> I'm coding a wicket 1.5 application and I need to control the way url are rendered for security reason.
>> 
>> mountPage("xxx/yyy", Zzzz.class)
>> 
>> is excellent for that but I have a problem with url generated for link listener. For exemple, if I add the following link to my page:
>> 
>> add(new Link<Void>("link-login") {
>>  @Override
>>  public void onClick() {
>>    setResponsePage(LoginPage.class);
>>  }
>> });
>> 
>> I obtain the following generated markup:
>> 
>> <a wicket:id="link-login" href="./home?0-1.ILinkListener-accessMenu-link~login">Login</a>
>> 
>> Is there a way to configure the generated url (./home?0-1.ILinkListener-accessMenu-link~login)? At least, I would like to remove the ~ character.
>> 
>> Tx for replies
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
> 
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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


Re: Wicket 1.5 - How to configure link generated url?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can use
mountPage("login", LoginPage.class);
add(new BookmarkablePageLink("link-login", LoginPage.class))

this will generate: /login.

Whay do you want to replace '~' ?

On Wed, Sep 19, 2012 at 1:47 PM, Nicolas Tacheny
<ni...@gmail.com> wrote:
> I'm coding a wicket 1.5 application and I need to control the way url are rendered for security reason.
>
> mountPage("xxx/yyy", Zzzz.class)
>
> is excellent for that but I have a problem with url generated for link listener. For exemple, if I add the following link to my page:
>
> add(new Link<Void>("link-login") {
>   @Override
>   public void onClick() {
>     setResponsePage(LoginPage.class);
>   }
> });
>
> I obtain the following generated markup:
>
> <a wicket:id="link-login" href="./home?0-1.ILinkListener-accessMenu-link~login">Login</a>
>
> Is there a way to configure the generated url (./home?0-1.ILinkListener-accessMenu-link~login)? At least, I would like to remove the ~ character.
>
> Tx for replies
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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