You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Rain <da...@kb.cz> on 2012/02/09 07:55:39 UTC

Re: Expiration of unversioned pages in Wicket 1.5

Martin Grigorov <mgrigorov <at> apache.org> writes:

> 
> can you create a ticket for this. I think I know what happens
> thanks!
> 
> On Fri, Sep 9, 2011 at 6:57 PM, pasto <peter.pastrnak <at> gmail.com> wrote:
> > Hi,
> >
> > in Wicket 1.5 RC7 is f.e. the RedirectPage set to unversioned, that makes 
it
> > impossible to render using the REDIRECT_TO_RENDER strategy. Because of this
> > flag the page instance is not being stored in the PageMap store, so it is
> > not accessible during the render phase. Is there some setting that can tell
> > Wicket to set unversioned pages as dirty (touch the page in pagemanager)
> > when using this strategy? Or I just didn't get the point? :)
> >
> > Thank you,
> > Peter.
> >
> > --
> > View this message in context: http://apache-
wicket.1842946.n4.nabble.com/Expiration-of-unversioned-pages-in-Wicket-1-5-
tp3802099p3802099.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe <at> wicket.apache.org
> > For additional commands, e-mail: users-help <at> wicket.apache.org
> >
> >
> 


Hi Martin!
I'm interested if an issue was created for this bug and if the problem was 
solved then? I couldn't find it anywhere in JIRA and I am now facing the 
(nearly) same problem.
I create the page (stateless), wrap it in PageProvider and 
RenderPageRequestHandler and make urlFor it to navigate a pure javascript 
modal window to it. But I get PageExpiredException for that new Page.
If I call getSession().getPageManager().touchPage(...) after creation, 
everything's fine, but I think this is not conceptual (I use it just as hotfix)

Running Wicket 1.5.4

Thanks for reply!

David



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


Re: Expiration of unversioned pages in Wicket 1.5

Posted by David Rain <da...@kb.cz>.
> On Thu, Feb 9, 2012 at 1:37 PM, Martin Grigorov <mgrigorov <at> apache.org> 
wrote:
> > Hi,
> >
> > I'm not sure whether this is the fix for this problem but we improved
> > org.apache.wicket.request.cycle.RequestCycle#setResponsePage(Page)
> > to set statelessHint to false even for stateless pages because without
> > saving them in the store we are not able to find them later after the
> > redirect.
> >
> > If you want to be stateless then you need to use
> > #setResponsePage(Class<Page>) instead. Redirecting to a pre-created
> > page instance is not stateless at all - stateless means that a new
> > page instance will be created for each request.
> >
> > On Thu, Feb 9, 2012 at 8:55 AM, David Rain <david_rain <at> kb.cz> wrote:
> >> Martin Grigorov <mgrigorov <at> apache.org> writes:
> >>
> >>>
> >>> can you create a ticket for this. I think I know what happens
> >>> thanks!
> >>>
> >>> On Fri, Sep 9, 2011 at 6:57 PM, pasto <peter.pastrnak <at> gmail.com> 
wrote:
> >>> > Hi,
> >>> >
> >>> > in Wicket 1.5 RC7 is f.e. the RedirectPage set to unversioned, that 
makes
> >> it
> >>> > impossible to render using the REDIRECT_TO_RENDER strategy. Because of 
this
> >>> > flag the page instance is not being stored in the PageMap store, so it 
is
> >>> > not accessible during the render phase. Is there some setting that can 
tell
> >>> > Wicket to set unversioned pages as dirty (touch the page in 
pagemanager)
> >>> > when using this strategy? Or I just didn't get the point? :)
> >>> >
> >>> > Thank you,
> >>> > Peter.
> >>> >
> >>> > --
> >>> > View this message in context: http://apache-
> >> wicket.1842946.n4.nabble.com/Expiration-of-unversioned-pages-in-Wicket-1-
5-
> >> tp3802099p3802099.html
> >>> > Sent from the Users forum mailing list archive at Nabble.com.
> >>> >
> >>> > ---------------------------------------------------------------------
> >>> > To unsubscribe, e-mail: users-unsubscribe <at> wicket.apache.org
> >>> > For additional commands, e-mail: users-help <at> wicket.apache.org
> >>> >
> >>> >
> >>>
> >>
> >>
> >> Hi Martin!
> >> I'm interested if an issue was created for this bug and if the problem was
> >> solved then? I couldn't find it anywhere in JIRA and I am now facing the
> >> (nearly) same problem.
> >> I create the page (stateless), wrap it in PageProvider and
> >> RenderPageRequestHandler and make urlFor it to navigate a pure javascript
> >> modal window to it. But I get PageExpiredException for that new Page.
> >> If I call getSession().getPageManager().touchPage(...) after creation,
> >> everything's fine, but I think this is not conceptual (I use it just as 
hotfix)
> >>
> >> Running Wicket 1.5.4
> >>
> >> Thanks for reply!
> >>
> >> David
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe <at> wicket.apache.org
> >> For additional commands, e-mail: users-help <at> wicket.apache.org
> >>
> >
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe <at> wicket.apache.org
> > For additional commands, e-mail: users-help <at> wicket.apache.org
> >
> 

Hi Martin!
Sorry for confusion! I didn't mean stateless page, but unversioned one. I'll 
give you an simplest example, it will do best:

PAGE 1:
public class WicketMainPage extends WebPage {
	public WicketMainPage() {
		PopupPage page = new PopupPage("Created: " + new Date());
	//	getSession().getPageManager().touchPage(page);
		PageProvider pp = new PageProvider(page);
		RenderPageRequestHandler rh = new RenderPageRequestHandler(pp);
		add(new Label("url", urlFor(rh).toString()));
	}
}

as you can see, I only create an instance of second page (which is not 
bookmarkable as it has some parameters), wrap it in page provider and request 
handler and simply output URL for it (of course it is an stateful URL).

The second page is just simple outputting text from constructor
PAGE 2:
public class PopupPage extends WebPage {
	public PopupPage(String text) {
		add(new Label("text", text));
	}
}

When I run this, the app outputs an relative part of URL to the second page... 
if I copy this into browser, everything works, when pages are versioned. But 
when I set setVersionPagesByDefault(false) I start to get PageExpiredException 
whe trying to access the second page. When I uncomment the touchPage line, 
everythings works even with unversiones paged.
I tried to debug the code of Wicket and I noticed, then the page is touched 
and thus stored in touched pages adn then in page map only when it is 
versioned.
So with unversiones paged, the second request (which carries only a pageId in 
URL in form /wicket/page?1...) does not find the page by id and the 
PageProvider throws the exception in getPageInstance().

I think, that instead of explicitly touching the page, it should be done by 
Wicket when retrieving the url for it. Somewhere in mapUrlFor or mapHandler, 
etc...

Thanks for your patience.
David




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


Re: Expiration of unversioned pages in Wicket 1.5

Posted by vineet semwal <vi...@gmail.com>.
yeah very true if it was done that way then user's state will be lost
in this use case,thanks !

On Thu, Feb 9, 2012 at 9:27 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> this is a bad idea. what if the user does
>
> MyPage p=new MyPage();
> p.setSomeFlag(true);
> setResponsePage(p);
>
> wicket doesnt know that the instance of MyPage is prestine, so it
> cannot make the decision to throw it away and redirect to another
> instance.
>
> -igor
>
> On Thu, Feb 9, 2012 at 12:42 AM, vineet semwal
> <vi...@gmail.com> wrote:
>>  what if RequestCycle#setResponsePage(Page) would have delegated to
>> RequestCycle#setResponsePage(Class<Page>) or
>> RequestCycle#setResponsePage(Class<Page>,Pageparameters)   after
>> checking whether the page#isstateless?
>> but then user wouldnt be able to pass state from constructor if he wanted ..
>>
>> On Thu, Feb 9, 2012 at 1:37 PM, Martin Grigorov <mg...@apache.org> wrote:
>>> Hi,
>>>
>>> I'm not sure whether this is the fix for this problem but we improved
>>> org.apache.wicket.request.cycle.RequestCycle#setResponsePage(Page)
>>> to set statelessHint to false even for stateless pages because without
>>> saving them in the store we are not able to find them later after the
>>> redirect.
>>>
>>> If you want to be stateless then you need to use
>>> #setResponsePage(Class<Page>) instead. Redirecting to a pre-created
>>> page instance is not stateless at all - stateless means that a new
>>> page instance will be created for each request.
>>>
>>> On Thu, Feb 9, 2012 at 8:55 AM, David Rain <da...@kb.cz> wrote:
>>>> Martin Grigorov <mgrigorov <at> apache.org> writes:
>>>>
>>>>>
>>>>> can you create a ticket for this. I think I know what happens
>>>>> thanks!
>>>>>
>>>>> On Fri, Sep 9, 2011 at 6:57 PM, pasto <peter.pastrnak <at> gmail.com> wrote:
>>>>> > Hi,
>>>>> >
>>>>> > in Wicket 1.5 RC7 is f.e. the RedirectPage set to unversioned, that makes
>>>> it
>>>>> > impossible to render using the REDIRECT_TO_RENDER strategy. Because of this
>>>>> > flag the page instance is not being stored in the PageMap store, so it is
>>>>> > not accessible during the render phase. Is there some setting that can tell
>>>>> > Wicket to set unversioned pages as dirty (touch the page in pagemanager)
>>>>> > when using this strategy? Or I just didn't get the point? :)
>>>>> >
>>>>> > Thank you,
>>>>> > Peter.
>>>>> >
>>>>> > --
>>>>> > View this message in context: http://apache-
>>>> wicket.1842946.n4.nabble.com/Expiration-of-unversioned-pages-in-Wicket-1-5-
>>>> tp3802099p3802099.html
>>>>> > Sent from the Users forum mailing list archive at Nabble.com.
>>>>> >
>>>>> > ---------------------------------------------------------------------
>>>>> > To unsubscribe, e-mail: users-unsubscribe <at> wicket.apache.org
>>>>> > For additional commands, e-mail: users-help <at> wicket.apache.org
>>>>> >
>>>>> >
>>>>>
>>>>
>>>>
>>>> Hi Martin!
>>>> I'm interested if an issue was created for this bug and if the problem was
>>>> solved then? I couldn't find it anywhere in JIRA and I am now facing the
>>>> (nearly) same problem.
>>>> I create the page (stateless), wrap it in PageProvider and
>>>> RenderPageRequestHandler and make urlFor it to navigate a pure javascript
>>>> modal window to it. But I get PageExpiredException for that new Page.
>>>> If I call getSession().getPageManager().touchPage(...) after creation,
>>>> everything's fine, but I think this is not conceptual (I use it just as hotfix)
>>>>
>>>> Running Wicket 1.5.4
>>>>
>>>> Thanks for reply!
>>>>
>>>> David
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>>
>>
>> --
>> thank you,
>>
>> regards,
>> Vineet Semwal
>>
>> ---------------------------------------------------------------------
>> 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
>



-- 
thank you,

regards,
Vineet Semwal

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


Re: Expiration of unversioned pages in Wicket 1.5

Posted by Igor Vaynberg <ig...@gmail.com>.
this is a bad idea. what if the user does

MyPage p=new MyPage();
p.setSomeFlag(true);
setResponsePage(p);

wicket doesnt know that the instance of MyPage is prestine, so it
cannot make the decision to throw it away and redirect to another
instance.

-igor

On Thu, Feb 9, 2012 at 12:42 AM, vineet semwal
<vi...@gmail.com> wrote:
>  what if RequestCycle#setResponsePage(Page) would have delegated to
> RequestCycle#setResponsePage(Class<Page>) or
> RequestCycle#setResponsePage(Class<Page>,Pageparameters)   after
> checking whether the page#isstateless?
> but then user wouldnt be able to pass state from constructor if he wanted ..
>
> On Thu, Feb 9, 2012 at 1:37 PM, Martin Grigorov <mg...@apache.org> wrote:
>> Hi,
>>
>> I'm not sure whether this is the fix for this problem but we improved
>> org.apache.wicket.request.cycle.RequestCycle#setResponsePage(Page)
>> to set statelessHint to false even for stateless pages because without
>> saving them in the store we are not able to find them later after the
>> redirect.
>>
>> If you want to be stateless then you need to use
>> #setResponsePage(Class<Page>) instead. Redirecting to a pre-created
>> page instance is not stateless at all - stateless means that a new
>> page instance will be created for each request.
>>
>> On Thu, Feb 9, 2012 at 8:55 AM, David Rain <da...@kb.cz> wrote:
>>> Martin Grigorov <mgrigorov <at> apache.org> writes:
>>>
>>>>
>>>> can you create a ticket for this. I think I know what happens
>>>> thanks!
>>>>
>>>> On Fri, Sep 9, 2011 at 6:57 PM, pasto <peter.pastrnak <at> gmail.com> wrote:
>>>> > Hi,
>>>> >
>>>> > in Wicket 1.5 RC7 is f.e. the RedirectPage set to unversioned, that makes
>>> it
>>>> > impossible to render using the REDIRECT_TO_RENDER strategy. Because of this
>>>> > flag the page instance is not being stored in the PageMap store, so it is
>>>> > not accessible during the render phase. Is there some setting that can tell
>>>> > Wicket to set unversioned pages as dirty (touch the page in pagemanager)
>>>> > when using this strategy? Or I just didn't get the point? :)
>>>> >
>>>> > Thank you,
>>>> > Peter.
>>>> >
>>>> > --
>>>> > View this message in context: http://apache-
>>> wicket.1842946.n4.nabble.com/Expiration-of-unversioned-pages-in-Wicket-1-5-
>>> tp3802099p3802099.html
>>>> > Sent from the Users forum mailing list archive at Nabble.com.
>>>> >
>>>> > ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail: users-unsubscribe <at> wicket.apache.org
>>>> > For additional commands, e-mail: users-help <at> wicket.apache.org
>>>> >
>>>> >
>>>>
>>>
>>>
>>> Hi Martin!
>>> I'm interested if an issue was created for this bug and if the problem was
>>> solved then? I couldn't find it anywhere in JIRA and I am now facing the
>>> (nearly) same problem.
>>> I create the page (stateless), wrap it in PageProvider and
>>> RenderPageRequestHandler and make urlFor it to navigate a pure javascript
>>> modal window to it. But I get PageExpiredException for that new Page.
>>> If I call getSession().getPageManager().touchPage(...) after creation,
>>> everything's fine, but I think this is not conceptual (I use it just as hotfix)
>>>
>>> Running Wicket 1.5.4
>>>
>>> Thanks for reply!
>>>
>>> David
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
>
> --
> thank you,
>
> regards,
> Vineet Semwal
>
> ---------------------------------------------------------------------
> 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: Expiration of unversioned pages in Wicket 1.5

Posted by vineet semwal <vi...@gmail.com>.
 what if RequestCycle#setResponsePage(Page) would have delegated to
RequestCycle#setResponsePage(Class<Page>) or
RequestCycle#setResponsePage(Class<Page>,Pageparameters)   after
checking whether the page#isstateless?
but then user wouldnt be able to pass state from constructor if he wanted ..

On Thu, Feb 9, 2012 at 1:37 PM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> I'm not sure whether this is the fix for this problem but we improved
> org.apache.wicket.request.cycle.RequestCycle#setResponsePage(Page)
> to set statelessHint to false even for stateless pages because without
> saving them in the store we are not able to find them later after the
> redirect.
>
> If you want to be stateless then you need to use
> #setResponsePage(Class<Page>) instead. Redirecting to a pre-created
> page instance is not stateless at all - stateless means that a new
> page instance will be created for each request.
>
> On Thu, Feb 9, 2012 at 8:55 AM, David Rain <da...@kb.cz> wrote:
>> Martin Grigorov <mgrigorov <at> apache.org> writes:
>>
>>>
>>> can you create a ticket for this. I think I know what happens
>>> thanks!
>>>
>>> On Fri, Sep 9, 2011 at 6:57 PM, pasto <peter.pastrnak <at> gmail.com> wrote:
>>> > Hi,
>>> >
>>> > in Wicket 1.5 RC7 is f.e. the RedirectPage set to unversioned, that makes
>> it
>>> > impossible to render using the REDIRECT_TO_RENDER strategy. Because of this
>>> > flag the page instance is not being stored in the PageMap store, so it is
>>> > not accessible during the render phase. Is there some setting that can tell
>>> > Wicket to set unversioned pages as dirty (touch the page in pagemanager)
>>> > when using this strategy? Or I just didn't get the point? :)
>>> >
>>> > Thank you,
>>> > Peter.
>>> >
>>> > --
>>> > View this message in context: http://apache-
>> wicket.1842946.n4.nabble.com/Expiration-of-unversioned-pages-in-Wicket-1-5-
>> tp3802099p3802099.html
>>> > Sent from the Users forum mailing list archive at Nabble.com.
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe <at> wicket.apache.org
>>> > For additional commands, e-mail: users-help <at> wicket.apache.org
>>> >
>>> >
>>>
>>
>>
>> Hi Martin!
>> I'm interested if an issue was created for this bug and if the problem was
>> solved then? I couldn't find it anywhere in JIRA and I am now facing the
>> (nearly) same problem.
>> I create the page (stateless), wrap it in PageProvider and
>> RenderPageRequestHandler and make urlFor it to navigate a pure javascript
>> modal window to it. But I get PageExpiredException for that new Page.
>> If I call getSession().getPageManager().touchPage(...) after creation,
>> everything's fine, but I think this is not conceptual (I use it just as hotfix)
>>
>> Running Wicket 1.5.4
>>
>> Thanks for reply!
>>
>> David
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>



-- 
thank you,

regards,
Vineet Semwal

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


Re: Expiration of unversioned pages in Wicket 1.5

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

I'm not sure whether this is the fix for this problem but we improved
org.apache.wicket.request.cycle.RequestCycle#setResponsePage(Page)
to set statelessHint to false even for stateless pages because without
saving them in the store we are not able to find them later after the
redirect.

If you want to be stateless then you need to use
#setResponsePage(Class<Page>) instead. Redirecting to a pre-created
page instance is not stateless at all - stateless means that a new
page instance will be created for each request.

On Thu, Feb 9, 2012 at 8:55 AM, David Rain <da...@kb.cz> wrote:
> Martin Grigorov <mgrigorov <at> apache.org> writes:
>
>>
>> can you create a ticket for this. I think I know what happens
>> thanks!
>>
>> On Fri, Sep 9, 2011 at 6:57 PM, pasto <peter.pastrnak <at> gmail.com> wrote:
>> > Hi,
>> >
>> > in Wicket 1.5 RC7 is f.e. the RedirectPage set to unversioned, that makes
> it
>> > impossible to render using the REDIRECT_TO_RENDER strategy. Because of this
>> > flag the page instance is not being stored in the PageMap store, so it is
>> > not accessible during the render phase. Is there some setting that can tell
>> > Wicket to set unversioned pages as dirty (touch the page in pagemanager)
>> > when using this strategy? Or I just didn't get the point? :)
>> >
>> > Thank you,
>> > Peter.
>> >
>> > --
>> > View this message in context: http://apache-
> wicket.1842946.n4.nabble.com/Expiration-of-unversioned-pages-in-Wicket-1-5-
> tp3802099p3802099.html
>> > Sent from the Users forum mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe <at> wicket.apache.org
>> > For additional commands, e-mail: users-help <at> wicket.apache.org
>> >
>> >
>>
>
>
> Hi Martin!
> I'm interested if an issue was created for this bug and if the problem was
> solved then? I couldn't find it anywhere in JIRA and I am now facing the
> (nearly) same problem.
> I create the page (stateless), wrap it in PageProvider and
> RenderPageRequestHandler and make urlFor it to navigate a pure javascript
> modal window to it. But I get PageExpiredException for that new Page.
> If I call getSession().getPageManager().touchPage(...) after creation,
> everything's fine, but I think this is not conceptual (I use it just as hotfix)
>
> Running Wicket 1.5.4
>
> Thanks for reply!
>
> David
>
>
>
> ---------------------------------------------------------------------
> 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