« Return to Thread: Hot to use BookmarkablePageLinks with a page mounted at several pathes?

Re: Hot to use BookmarkablePageLinks with a page mounted at several pathes?

by okrohne :: Rate this Message:

Reply to Author | View in Thread

Hi,

I mount the pages for all categories and subcategories starting at the
root path of my application.
/entertainment/movies
/entertainment/books and so on.

If I would mount the page e.g. at /categories then I would have url like
/categories/entertainment/movie which are not so nice.

In general the problem only exists because I have extended the PagingNavigator to have a stateless PagingNavigator and need to override these functions :
protected Link<?> newPagingNavigationIncrementLink
protected Link<?> newPagingNavigationLink
and they must return an instance of type Link so I can not simply return an
ExternalLink.

I solved the problem by overiding the getURL function of BookmarkablePageLink
to generate links like /entertainment/movie/1 /entertainment/movie/2
where the paramter "1" and "2" are used for a stateless navigator.

If I have more time then I will clean up and write sligthly modified IndexedParamCodingStrategy.

Thanks,
Oliver

jthomerson wrote:
You might need to create your own url coding strategy that answers for
all the mount paths for that page.  The built-in one is only for a
single page at a single path.

Why do you have a single page on multiple paths?  Does the page
respond differently based on path?  Should the pages on different
paths be subclasses of the main page?  Or are you simply trying to
avoid an extra parameter?  What about mounting the page on "/path" and
then using an indexed parameter mount so that it is "/path/a/id"?

--
Jeremy Thomerson
http://www.wickettraining.com




On Mon, Jul 6, 2009 at 3:15 AM, Oliver Krohne<okrohne@yahoo.de> wrote:
> Hi,
>
> I have one page which is mounted at several pathes with IndexParamUrlCodingStrategy e.g. :
> /pathA
> /pathB
>
> Now I want to create BookmarkablePageLinks with PageParameters and a specific path of the page, e.g.
> /pathA/id where "id" is the page parameter.
>
> The problems is that rendering url calls BookmarkablePageRequestTargetUrlCodingStrategy.matches
> which only checks the Page class but not the mount path, so the
> url is (in my case) /pathB/id which is wrong. So i tried to use the mount path as
> first parameter and the id as second parameter but this generates:
> /pathB/pathA/id
>
> If call the page /pathA/id directly in the browser everthing is okay as the method
> IRequestTargetUrlCodingStrategy.urlCodingStrategyForPath(String path)
> takes care of the mount path.
>
> So what can I do the specify the mount path + PageParameters in the BookmarkablePageLink?
>
> Extend BookmarkablePageLink and overide onComponentTag ?
>
> Thanks,
> Oliver
>
>
>

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

 « Return to Thread: Hot to use BookmarkablePageLinks with a page mounted at several pathes?