You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2014/07/09 16:00:19 UTC

[jira] [Commented] (WICKET-5578) Stateless/Statefull pages - incorrect behaviour

    [ https://issues.apache.org/jira/browse/WICKET-5578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14056252#comment-14056252 ] 

Martin Grigorov commented on WICKET-5578:
-----------------------------------------

An easy workaround for the current case is to use:
{code}
AjaxLink#isVisible() {return AuthenticatedWebSession.get().isSignedIn() && super.isVisible(); } 
{code}

instead of using 
{code}
onConfigure() { setVisible(AuthenticatedWebSession.get().isSignedIn()) }
{code}

The problem with onConfigure() is that it is called at the RENDER phase (onBeforeRender, onConfigure, render, onAfterRender) of the component lifecycle. By using #isVisible() you have the chance to decide whether the page is stateless also in the ACTION phase (onClick/onSubmit/etc.).

[~bitstorm] canCallListenerInterfaceAfterExpiry() is only in 7.x. I agree with your suggested change. Please convert the attached quickstart to a unit test and apply it in 7.x. Thanks!

> Stateless/Statefull pages - incorrect behaviour
> -----------------------------------------------
>
>                 Key: WICKET-5578
>                 URL: https://issues.apache.org/jira/browse/WICKET-5578
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.0.0-M1, 6.15.0
>            Reporter: Ilia Naryzhny
>              Labels: stateful, stateless
>         Attachments: wicket5578.zip
>
>
> Please advise how to do in following situation or confirm that's a bug and should be fixed.
> There is a page (login page) with stateless form. That page has lots of common components (menu and etc.). There are some stateful components in the components tree that are visible only for signed in users: but once user isn't signed in - that components are hidden. That's why page is becoming "stateless" (no visible components) and form prepared correspondingly. But when form data is submitted: during obtaining of form component to process request - wicket thinks that page actually is stateful. As a result - the page is recreated and fully rendered - instead of processing of the form.
> There is a workaround: setStatelessHint(false). But imho reason is a little bit another:
> 1) After construction of page: page is stateful - because of some stateful components are in the tree.
> 2) After initialization of page: page is still stateful - because there are that stateful components
> 3) After configuration of page (method onConfigure) - page is becoming stateless - because all stateful components marked as invisible.
> 4) Form has been rendered as stateless - with no version number is in the URL.
> 5) Page can'be reconstructed correctly because of p.1 and p.2
> I think that stateless flag should be precalculated right after initialization step and should be changed due to some stuff in "configuration" methods.
> What do you think?
> Will provide "quick start" in near future!



--
This message was sent by Atlassian JIRA
(v6.2#6252)