Hi,

AppEngine uses Jetty and I remembered about
https://issues.apache.org/jira/browse/WICKET-5390.
Here the reporter explains that Jetty won't update its SessionStore if it
believes the http session didn't change.
Wicket stores both o.a.w.Session and all pages rendered in the last request
as attributes in the http session.
If Jetty doesn't detect the change(s) in the http session it will not store
it and later will serve a http session with obsolete data inside.
By doing "getSession().setAttribute("blah", somethingRandom)" we try to
help Jetty realize that there is a change and make sure it saves the latest
state.
You can move this helper code in IRequestCycleListener#onEndRequest() so it
is executed for every request.
If I am correct then this should workaround the problem.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, May 15, 2015 at 12:00 AM, Christopher Merrill <
[email protected]> wrote:

> Oh, and what you probably also wanted to know: When I press refresh on the
> page, the message from the constructor does not appear in the logs again.
> Also nothing after pressing the button (which does nothing).
>
> On Thu, May 14, 2015 at 4:50 PM, Christopher Merrill <
> [email protected]> wrote:
>
> > I added the getSession().setAttribute() into the page constructor. When I
> > hit the page, I see two lines in the AppEngine logs. The first is for the
> > URL I put in the browser (/portal/pages/Test), which indicates a 302
> > response to the browser and the log entry also contains the debug message
> > that I included along with the setAttribute() line.
> >
> > The next line in the logs is for URL /portal/pages/Test?1 and is a 200
> > response with the page content.
> >
> > Does that help?
> >
> > Chris
> >
> > On Thu, May 14, 2015 at 4:42 PM, Christopher Merrill <
> > [email protected]> wrote:
> >
> >> I added that line, along with
> >>   Debug.log.out("the test attribute is: " +
> >> getSession().getAttribute("test"));
> >> in the onSubmit() method of the AjaxButton.
> >>
> >> If I DO NOT refresh the page before pressing the button, then it prints
> >> the message with the date in the logs.
> >>
> >> If I do refresh the page, nothing...which I take to mean that the code
> >> never runs.
> >>
> >> I'll try it in the constructor for the page.
> >>
> >> Chris
> >>
> >>
> >> On Thu, May 14, 2015 at 4:35 PM, Martin Grigorov <[email protected]>
> >> wrote:
> >>
> >>> OK, then also put the same line in some constructor that is invoked.
> >>>
> >>> Martin Grigorov
> >>> Wicket Training and Consulting
> >>> https://twitter.com/mtgrigorov
> >>>
> >>> On Thu, May 14, 2015 at 11:32 PM, Christopher Merrill <
> >>> [email protected]> wrote:
> >>>
> >>> > I'll do that. It'll take a few minutes to deploy that back up to
> >>> AppEngine.
> >>> >
> >>> > But I don't think that code will be executed - I feel pretty
> confident
> >>> that
> >>> > the event listeners are not being invoked. At least, my debug
> >>> statements in
> >>> > the event listener do not get into the AppEngine logs.
> >>> >
> >>> > Chris
> >>> >
> >>> >
> >>> > On Thu, May 14, 2015 at 4:23 PM, Martin Grigorov <
> [email protected]
> >>> >
> >>> > wrote:
> >>> >
> >>> > > Can you try something else:
> >>> > > in onClick() add code like: getSession.setAttribute("test", new
> >>> Date())
> >>> > >
> >>> > > Martin Grigorov
> >>> > > Wicket Training and Consulting
> >>> > > https://twitter.com/mtgrigorov
> >>> > >
> >>> > > On Thu, May 14, 2015 at 11:18 PM, Christopher Merrill <
> >>> > > [email protected]> wrote:
> >>> > >
> >>> > > > Thanks for your help, Martin!
> >>> > > >
> >>> > > > I turned off page recreation by adding:
> >>> > > >
> >>> > > > getPageSettings().setRecreateMountedPagesAfterExpiry(false);
> >>> > > >
> >>> > > > to my Application.init() method.
> >>> > > >
> >>> > > > There is no change in the behavior, either locally or in
> AppEngine
> >>> --
> >>> > > i.e.
> >>> > > > no page expired errors.
> >>> > > >
> >>> > > > You can observe the behavior here:
> >>> > > > http://1.wp-portal-staging.appspot.com/portal/pages/Test
> >>> > > >
> >>> > > > by visiting the page, refreshing it and then pressing a button
> >>> (which
> >>> > > will
> >>> > > > do nothing if you refreshed). I posted the code for that page in
> >>> > another
> >>> > > > thread ("Model value change lost between AjaxButton.onSubmit()
> and
> >>> > > > form.onSubmit()"), in case that helps.
> >>> > > >
> >>> > > > TIA!
> >>> > > > Chris
> >>> > > >
> >>> > > >
> >>> > > >
> >>> > > > On Thu, May 14, 2015 at 3:43 PM, Martin Grigorov <
> >>> [email protected]
> >>> > >
> >>> > > > wrote:
> >>> > > >
> >>> > > > > Hi,
> >>> > > > >
> >>> > > > > My guess is that there is some problem with the saving of the
> >>> page in
> >>> > > the
> >>> > > > > backing stores.
> >>> > > > > Try by disabling page recreation for expired pages, see
> >>> > IPageSettings,
> >>> > > > > If I'm right then you should start seeing PageExpiredPage after
> >>> > > clicking
> >>> > > > > the link.
> >>> > > > > The next step is will be to find why the pages could not be
> >>> stored.
> >>> > > > >
> >>> > > > > Martin Grigorov
> >>> > > > > Wicket Training and Consulting
> >>> > > > > https://twitter.com/mtgrigorov
> >>> > > > >
> >>> > > > > On Thu, May 14, 2015 at 9:40 PM, Christopher Merrill <
> >>> > > > > [email protected]> wrote:
> >>> > > > >
> >>> > > > > > I'm seeing problems throughout our app where refreshing the
> >>> page
> >>> > > causes
> >>> > > > > > other event listeners to then malfunction. These are
> trivially
> >>> > simple
> >>> > > > > > listeners, like:
> >>> > > > > >
> >>> > > > > > Link customer_link = new Link("org_link")
> >>> > > > > >     {
> >>> > > > > >     @Override
> >>> > > > > >     public void onClick()
> >>> > > > > >         {
> >>> > > > > >         setResponsePage(new
> >>> > > > > > OrganizationAdministrationPage(getPageReference(),
> >>> > > > > > _organization_key));
> >>> > > > > >         }
> >>> > > > > >
> >>> > > > > >     private static final long serialVersionUID =
> >>> > > -6396556709778260098L;
> >>> > > > > >     };
> >>> > > > > >
> >>> > > > > >
> >>> > > > > > Instead of returning the response page, the browser receives
> a
> >>> > > forward
> >>> > > > > > (302) back to the same page instance...which of course means
> >>> that
> >>> > the
> >>> > > > > link
> >>> > > > > > appears to do nothing.
> >>> > > > > >
> >>> > > > > > I can only reproduce this behavior when the app is deployed
> to
> >>> > > > AppEngine
> >>> > > > > --
> >>> > > > > > it works fine running on my desktop. The problems started
> when
> >>> we
> >>> > > > > upgraded
> >>> > > > > > the application to Wicket 6. I'm not implying this is a
> Wicket
> >>> 6
> >>> > > > > > problem...in fact I assume we have done something that is
> >>> causing
> >>> > > this
> >>> > > > > > malfunction. But since it worked under Wicket 5, I'm hoping
> >>> someone
> >>> > > > will
> >>> > > > > > see a relationship between the symptoms and a change that we
> >>> need
> >>> > to
> >>> > > > make
> >>> > > > > > for compatibility with Wicket 6.
> >>> > > > > >
> >>> > > > > > Any hints or debugging ideas (since I can't step through the
> >>> code
> >>> > > > running
> >>> > > > > > in AppEngine) would be greatly appreciated!
> >>> > > > > >
> >>> > > > > > Chris
> >>> > > > > >
> >>> > > > >
> >>> > > >
> >>> > >
> >>> >
> >>>
> >>
> >>
> >
>

Reply via email to