Hi,

I was recently wondering is there request coding strategy which would allow me 
to have one page instance of certain class per session, so after requesting 
mounted url user would always use the same page instance or a new one would 
be created if there was no instance of that class.

One of the reasons I thought about it is because I wanted "very nice" urls, so 
that after clicking links/ submitting forms url would remain exactly the same 
as mount. And another reason is that I wanted to be able to return to the 
page without passing its instance to another page.

Do you think such coding strategy is sensible?


I actually tried to implement it by extending 
AbstractRequestTargetUrlCodingStrategy. The idea was that I would have one 
pagemap for each mounted page and in the pagemap there would be the only 
instance of that page. Here is some naive code:

private final String pagemapName;
...
public IRequestTarget decode(RequestParameters requestParameters) {
    final IPageMap pageMap = PageMap.forName(pagemapName);

    // didn't find how to get the latest version of the page
    if (pageMap.containsPage(0, 0)) {
        final Page page = pageMap.get(0, 0);
        return new PageRequestTarget(page);
    } else {
        // the page created by this bookmarkable target is not in the 
        // pagemap "pagemapName", didn't find how to put it there
        return new BookmarkablePageRequestTarget(pagemapName, pageClass);
    }
}


ps sorry if such strategy is already there and I just didn't understand it's 
what I want

Dima

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to