You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Steve Swinsburg <s....@lancaster.ac.uk> on 2009/02/10 14:10:42 UTC
mountBookmarkablePage changes delimiter of PageParameters
Hi all,
I have just noticed that mountBookmarkablePage changes the delimiters
of query string object to be all forward slashes. Why is this?
For instance I want to get a url to a page class:
urlFor(MyPage.class, new PageParameters("id=" + userId)).toString());
which gives:
?wicket:bookmarkablePage=:my.package.here.MyPage&id=123456789
which is fine, but I wanted to get rid of the package name, so I
mounted the page like so:
mountBookmarkablePage("/myPage", MyPage.class);
and the same urlFor result gives:
myPage/id/123456789/
In my circumstances I cannot have slashes (legacy restriction) and
must have the ?&= style parameters but I still need the package to be
hidden, how could I go about doing this?
cheers,
Steve
Re: mountBookmarkablePage changes delimiter of PageParameters
Posted by Erik van Oosten <e....@grons.nl>.
Steve,
Try to mount with the MixedParamUrlCodingStrategy.
Regards,
Erik.
Steve Swinsburg wrote:
>
>
> Hi all,
>
> I have just noticed that mountBookmarkablePage changes
> the delimiters of query string object to be all forward slashes. Why
> is this?
> For instance I want to get a url to a page class:
> urlFor(MyPage.class, new PageParameters("id=" + userId)).toString());
>
> which gives:
> ?wicket:bookmarkablePage=:my.package.here.MyPage&id=123456789
>
>
> which is fine, but I wanted to get rid of the package name, so I
> mounted the page like so:
>
> mountBookmarkablePage("/myPage", MyPage.class);
>
> and the same urlFor result gives:
>
> myPage/id/123456789/
>
>
> In my circumstances I cannot have slashes (legacy restriction) and
> must have the ?&= style parameters but I still need the package to be
> hidden, how could I go about doing this?
>
>
>
>
> cheers,
> Steve
>
>
>
>
>
>
>
--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: mountBookmarkablePage changes delimiter of PageParameters
Posted by Steve Swinsburg <s....@lancaster.ac.uk>.
Thanks Fabrizio I'll give it a go.
Re having a default parameter, I found this that may help? Haven't
tried it myself:
use IndexedParamUrlCodingStrategy to mount your page.
e.g.
params.put("0", foo);
params.put("1", bar);
params.put("2", cux);
will result in mountpoint/foo/bar/cux (in that order)
cheers,
Steve
On 10 Feb 2009, at 13:45, Fabrizio Giudici wrote:
> Of course the arguments in my example have been copied in a hurry
> from working code, the former is the path and the latter the page
> class:
>
> mount(new QueryStringUrlCodingStrategy(path, class));
>
>
> --
> Fabrizio Giudici - Java Architect, Project Manager
> Tidalwave s.a.s. - "We make Java work. Everywhere."
> weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
> Fabrizio.Giudici@tidalwave.it - mobile: +39 348.150.6941
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
Re: mountBookmarkablePage changes delimiter of PageParameters
Posted by Fabrizio Giudici <fa...@tidalwave.it>.
Of course the arguments in my example have been copied in a hurry from
working code, the former is the path and the latter the page class:
mount(new QueryStringUrlCodingStrategy(path, class));
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@tidalwave.it - mobile: +39 348.150.6941
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: mountBookmarkablePage changes delimiter of PageParameters
Posted by Fabrizio Giudici <fa...@tidalwave.it>.
Steve Swinsburg wrote:
>
>
> Hi all,
>
> I have just noticed that mountBookmarkablePage changes
> the delimiters of query string object to be all forward slashes. Why
> is this?
> For instance I want to get a url to a page class:
> urlFor(MyPage.class, new PageParameters("id=" + userId)).toString());
>
> which gives:
> ?wicket:bookmarkablePage=:my.package.here.MyPage&id=123456789
>
>
> which is fine, but I wanted to get rid of the package name, so I
> mounted the page like so:
>
> mountBookmarkablePage("/myPage", MyPage.class);
>
> and the same urlFor result gives:
>
> myPage/id/123456789/
>
>
> In my circumstances I cannot have slashes (legacy restriction) and
> must have the ?&= style parameters but I still need the package to be
> hidden, how could I go about doing this?
Use this:
mount(new QueryStringUrlCodingStrategy(pages[i+1], pageClass));
This will use the coding strategy you need. BTW, I'd like to have
something as:
myPage/123456789
that is "id" should be treated as a default parameter. I've searched but
I didn't find a preset UrlCodingStrategy: I suppose I need to write my
own, right?
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@tidalwave.it - mobile: +39 348.150.6941