You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ondrej Zizka <oz...@redhat.com> on 2013/03/04 15:23:29 UTC

Processing form input at the start of a session?

Hi all,

let's have a bookmarkable page with a form.
This form is submitted after session expiration.
The result is that Wicket ignores the input and renders the page as it 
was just loaded by URL.

How can I make Wicket process the POST body and do the whole cycle - 
fill the models, validate, etc.?

Thanks,
Ondra

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


Re: Processing form input at the start of a session?

Posted by Bernard <bh...@gmail.com>.
Hi,

On Mon, 04 Mar 2013 22:16:06 +0100, you wrote:

>Thanks, I thought this answer will come. Let me ask differently:
>
>What is it which prevents Wicket applying the input on the first request?
>
Please see the comments in ListenerInterfaceRequestHandler#respond()

Wicket ignores the input if the page is re-created after expiry.

>What's the conceptual difference between creating a page, rendering a 
>page, receiving a request and applying the incoming data,
>versus creating a page and applying the incoming data? Regardless of 
>whether there are stateful components or not.

Please see ListenerInterfaceRequestHandler#respond()

A stateful page might get fetched from the page store if it is not
expired. Alternatively, after expiry, it is created with its page
constructor.

A page is rendered after the incoming data and any other model data is
applied to the page instance.

>
>Is this going to be targetted in the future?
>

Please see the jira links below.

>I believe this has been discussed, so a link to such conversation is 
>appreciated.

Please see for an example discussion (AJAX)
http://stackoverflow.com/questions/10582601/how-can-i-make-wickets-ajaxlink-stateless



There are jira issues to improve Wicket's response to various page
expiry scenarios:

Optionally execute Callback Behavior on Re-construction after Expiry
https://issues.apache.org/jira/browse/WICKET-5070

PageParameters missing from re-created Page
https://issues.apache.org/jira/browse/WICKET-5068

Mounted bookmarkable Page not recreated on Session Expiry
https://issues.apache.org/jira/browse/WICKET-4997

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

Recovery of bookmarkable Page after Session Expiry
https://issues.apache.org/jira/browse/WICKET-5001

Validation and Code Quality Issues with "Default Constructor" on
Re-creation after Page Expiry
https://issues.apache.org/jira/browse/WICKET-5069

I think that for best results, only minimal cooperation of the
application with the framework, e.g. some configuration in the page
object is required.

IMHO Wicket is in the position to eliminate most existing issues
related to PageExpiredException. So far, Wicket has adopted a black
and white approach to server state which is basically denial of
service. The justification has been that Wicket does not know whether
the component state is valid after reconstruction of the page
(re-construction being is a relatively recent addition since
https://issues.apache.org/jira/browse/WICKET-4014)

So not knowing whether the component state after re-constructing the
page is valid, Wicket currently refuses to invoke behavior of links
and form submits.

My idea for an approach is to keep some vital state e.g. record ID,
edit/view mode, in PageParameters client side and manage the loss of
the remaining state gracefully. In this context, it is interesting to
know that AJAX components make the page stateful but often such state
is not vital for invocation of behavior after expiry.

Wicket server side component state provides a great advantage compared
with having to encode all state in parameters and pass it to and from
the client.

However this advantage is over-compensated by the effort one has to
spend on testing and fixing the expiry behavior of every single page
of a site. The effort can be enormous.

Regards,

Bernard

>
>Thanks!
>Ondra
>
>
>
>On 03/04/2013 03:27 PM, Martin Grigorov wrote:
>> Hi,
>>
>> Make the page stateless, i.e. StatelessForm instead and avoid any other
>> stateful components.
>>
>>
>> On Mon, Mar 4, 2013 at 4:23 PM, Ondrej Zizka <oz...@redhat.com> wrote:
>>
>>> Hi all,
>>>
>>> let's have a bookmarkable page with a form.
>>> This form is submitted after session expiration.
>>> The result is that Wicket ignores the input and renders the page as it was
>>> just loaded by URL.
>>>
>>> How can I make Wicket process the POST body and do the whole cycle - fill
>>> the models, validate, etc.?
>>>
>>> Thanks,
>>> Ondra
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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: Processing form input at the start of a session?

Posted by Ondrej Zizka <oz...@redhat.com>.
Thanks, I thought this answer will come. Let me ask differently:

What is it which prevents Wicket applying the input on the first request?

What's the conceptual difference between creating a page, rendering a 
page, receiving a request and applying the incoming data,
versus creating a page and applying the incoming data? Regardless of 
whether there are stateful components or not.

Is this going to be targetted in the future?

I believe this has been discussed, so a link to such conversation is 
appreciated.

Thanks!
Ondra



On 03/04/2013 03:27 PM, Martin Grigorov wrote:
> Hi,
>
> Make the page stateless, i.e. StatelessForm instead and avoid any other
> stateful components.
>
>
> On Mon, Mar 4, 2013 at 4:23 PM, Ondrej Zizka <oz...@redhat.com> wrote:
>
>> Hi all,
>>
>> let's have a bookmarkable page with a form.
>> This form is submitted after session expiration.
>> The result is that Wicket ignores the input and renders the page as it was
>> just loaded by URL.
>>
>> How can I make Wicket process the POST body and do the whole cycle - fill
>> the models, validate, etc.?
>>
>> Thanks,
>> Ondra
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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: Processing form input at the start of a session?

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

Make the page stateless, i.e. StatelessForm instead and avoid any other
stateful components.


On Mon, Mar 4, 2013 at 4:23 PM, Ondrej Zizka <oz...@redhat.com> wrote:

> Hi all,
>
> let's have a bookmarkable page with a form.
> This form is submitted after session expiration.
> The result is that Wicket ignores the input and renders the page as it was
> just loaded by URL.
>
> How can I make Wicket process the POST body and do the whole cycle - fill
> the models, validate, etc.?
>
> Thanks,
> Ondra
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>