You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bernard <bh...@gmail.com> on 2013/02/17 01:17:08 UTC

How to make a stateful mounted page bookmarkable?

Hi all,

We mount all our pages so that the user can open them from bookmarks.

But as soon as a page aquires some state - it does not matter how
insignificant that state is - the page mount is discarded and we get
URLs such as

/wicket/page?0

which cause PageExpiredException.

We can always re-create a formerly stateful page without state because
that is very easy. It is far better than PageExpiredException. But we
can't do it if Wicket does not tell us which page to create even if
the page is mounted.

The question: How to get a bookmarkable URL for a stateful page
instead of /wicket/page?0

Regards,

Bernard




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


Re: How to make a stateful mounted page bookmarkable?

Posted by Bernard <bh...@gmail.com>.
A convenient way to check how Wicket considers pages bookmarkable:
    @Override
    public boolean bookmarkable() {
        boolean bookmarkable = super.isBookmarkable();
        if(! bookmarkable){
            throw new IllegalStateException("Page should be
bookmarkable");
        }
        return bookmarkable;
    }


What I am seeing with mountPackage() looks like a bug. Please see

Page not bookmarkable with WebApplication#mountPackage
https://issues.apache.org/jira/browse/WICKET-5043


Re your browser navigation back and forward. I try to avoid this by
using setVersioned(false). This is not perfect though because if the
link is from a page outside your Wicket site, and the user does not
yet have a session then there will be 2 versions of the page one with
;jsessionid=... and one without it. Haven't figured out how to get rid
of it.

If this does not suit you and you get nulls then I would suggest you
pinpoint this with a quickstart.

Regards,

Bernard



On Sun, 17 Feb 2013 06:05:52 +0100, you wrote:

>IIRC, bookmarkable pages need PageParameters, which also makes sense - 
>it must be able to reconstruct the page just from URL. IModel is just 
>stored in PageStore (or PageMap or how is it called) during a session.
>
>What bothers me more is that various back and forth moves always give 
>some nulls everywhere even when following this strategy... Didn't 
>understood yet how to fix that.
>
>my2c
>
>
>
>
>On 02/17/2013 05:02 AM, Bernard wrote:
>> Thanks. This works.
>>
>> But it does not work with PackageMapper via
>> WebApplication#mountPackage() with a Page constructor with IModel
>> parameter.
>>
>> Would this be an expected behavior?
>>
>> Regards,
>>
>> Bernard
>>
>>
>> On Sun, 17 Feb 2013 01:27:13 +0100, you wrote:
>>
>>> Have a look to MountedMapper
>>> And also the Wicket in Action blog http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/
>>>
>>>
>>> François Meillet
>>> Formation Wicket - Développement Wicket
>>>
>>>
>>>
>>>
>>>
>>> Le 17 févr. 2013 à 01:17, Bernard <bh...@gmail.com> a écrit :
>>>
>>>> Hi all,
>>>>
>>>> We mount all our pages so that the user can open them from bookmarks.
>>>>
>>>> But as soon as a page aquires some state - it does not matter how
>>>> insignificant that state is - the page mount is discarded and we get
>>>> URLs such as
>>>>
>>>> /wicket/page?0
>>>>
>>>> which cause PageExpiredException.
>>>>
>>>> We can always re-create a formerly stateful page without state because
>>>> that is very easy. It is far better than PageExpiredException. But we
>>>> can't do it if Wicket does not tell us which page to create even if
>>>> the page is mounted.
>>>>
>>>> The question: How to get a bookmarkable URL for a stateful page
>>>> instead of /wicket/page?0
>>>>
>>>> Regards,
>>>>
>>>> Bernard
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>


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


Re: How to make a stateful mounted page bookmarkable?

Posted by Ondrej Zizka <oz...@redhat.com>.
IIRC, bookmarkable pages need PageParameters, which also makes sense - 
it must be able to reconstruct the page just from URL. IModel is just 
stored in PageStore (or PageMap or how is it called) during a session.

What bothers me more is that various back and forth moves always give 
some nulls everywhere even when following this strategy... Didn't 
understood yet how to fix that.

my2c




On 02/17/2013 05:02 AM, Bernard wrote:
> Thanks. This works.
>
> But it does not work with PackageMapper via
> WebApplication#mountPackage() with a Page constructor with IModel
> parameter.
>
> Would this be an expected behavior?
>
> Regards,
>
> Bernard
>
>
> On Sun, 17 Feb 2013 01:27:13 +0100, you wrote:
>
>> Have a look to MountedMapper
>> And also the Wicket in Action blog http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/
>>
>>
>> François Meillet
>> Formation Wicket - Développement Wicket
>>
>>
>>
>>
>>
>> Le 17 févr. 2013 à 01:17, Bernard <bh...@gmail.com> a écrit :
>>
>>> Hi all,
>>>
>>> We mount all our pages so that the user can open them from bookmarks.
>>>
>>> But as soon as a page aquires some state - it does not matter how
>>> insignificant that state is - the page mount is discarded and we get
>>> URLs such as
>>>
>>> /wicket/page?0
>>>
>>> which cause PageExpiredException.
>>>
>>> We can always re-create a formerly stateful page without state because
>>> that is very easy. It is far better than PageExpiredException. But we
>>> can't do it if Wicket does not tell us which page to create even if
>>> the page is mounted.
>>>
>>> The question: How to get a bookmarkable URL for a stateful page
>>> instead of /wicket/page?0
>>>
>>> Regards,
>>>
>>> Bernard
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>


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


Re: How to make a stateful mounted page bookmarkable?

Posted by Bernard <bh...@gmail.com>.
Thanks. This works.

But it does not work with PackageMapper via
WebApplication#mountPackage() with a Page constructor with IModel
parameter.

Would this be an expected behavior?

Regards,

Bernard


On Sun, 17 Feb 2013 01:27:13 +0100, you wrote:

>Have a look to MountedMapper
>And also the Wicket in Action blog http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/
>
>
>François Meillet
>Formation Wicket - Développement Wicket
>
>
>
>
>
>Le 17 févr. 2013 à 01:17, Bernard <bh...@gmail.com> a écrit :
>
>> Hi all,
>> 
>> We mount all our pages so that the user can open them from bookmarks.
>> 
>> But as soon as a page aquires some state - it does not matter how
>> insignificant that state is - the page mount is discarded and we get
>> URLs such as
>> 
>> /wicket/page?0
>> 
>> which cause PageExpiredException.
>> 
>> We can always re-create a formerly stateful page without state because
>> that is very easy. It is far better than PageExpiredException. But we
>> can't do it if Wicket does not tell us which page to create even if
>> the page is mounted.
>> 
>> The question: How to get a bookmarkable URL for a stateful page
>> instead of /wicket/page?0
>> 
>> Regards,
>> 
>> Bernard
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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: How to make a stateful mounted page bookmarkable?

Posted by Francois Meillet <fr...@gmail.com>.
Have a look to MountedMapper
And also the Wicket in Action blog http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/


François Meillet
Formation Wicket - Développement Wicket





Le 17 févr. 2013 à 01:17, Bernard <bh...@gmail.com> a écrit :

> Hi all,
> 
> We mount all our pages so that the user can open them from bookmarks.
> 
> But as soon as a page aquires some state - it does not matter how
> insignificant that state is - the page mount is discarded and we get
> URLs such as
> 
> /wicket/page?0
> 
> which cause PageExpiredException.
> 
> We can always re-create a formerly stateful page without state because
> that is very easy. It is far better than PageExpiredException. But we
> can't do it if Wicket does not tell us which page to create even if
> the page is mounted.
> 
> The question: How to get a bookmarkable URL for a stateful page
> instead of /wicket/page?0
> 
> Regards,
> 
> Bernard
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>