Re: FlushSession never called on AjaxFormComponentUpdatingBehavior

2022-05-10 Thread Sven Meier

Hi Wayne,

>Is this a bug?

could be, do we have a Jira issue already?

I think there might be a call to Session#setMetaData() missing. Before 
Wicket 9.x it seemed to have been called additionally when a page is 
stored in the session.


I'll take a deeper look into this tomorrow.

Best regards
Sven


On 10.05.22 18:47, Wayne W wrote:

Hi,

I am *still* trying to troubleshoot why migrating to 9.4 we have found that
our app no longer supports session failover correctly. We use Redission to
store the tomcat session in Redis.

After a lot of debugging it appears that for
AjaxFormComponentUpdatingBehavior.onEvent() calls,
HttpSessionStore.flushSession() is never called after. And changes to the
model are not persisted in the HTTP Session and into Redis backed store.
The reason is setAttribute is never called on the session and therefore the
updated session with good model values is never persisted. And when the
next call arrives, the page is pulled back out of Redis/Http session
without the changes.

I had to do the following to get the wicket session to be stored in the
session within our Application:

ISerializer serializer = new JavaSerializer(getApplicationKey());
getFrameworkSettings().setSerializer(serializer);
getStoreSettings().setAsynchronous(false);
setPageManagerProvider(new DefaultPageManagerProvider(this) {
 protected IPageStore newCachingStore(IPageStore pageStore)
 {
 return new CachingPageStore(pageStore, new InSessionPageStore( 2,
serializer));
 }
 });

The objects are updated in the session page object instance correctly with
AjaxFormComponentUpdatingBehavior , however this issue is they are never
saved/persisted as setAttribute is not called. So the next request comes
and a new page object instance is unserialized from the store without the
changes.

Is this a bug?



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



FlushSession never called on AjaxFormComponentUpdatingBehavior

2022-05-10 Thread Wayne W
Hi,

I am *still* trying to troubleshoot why migrating to 9.4 we have found that
our app no longer supports session failover correctly. We use Redission to
store the tomcat session in Redis.

After a lot of debugging it appears that for
AjaxFormComponentUpdatingBehavior.onEvent() calls,
HttpSessionStore.flushSession() is never called after. And changes to the
model are not persisted in the HTTP Session and into Redis backed store.
The reason is setAttribute is never called on the session and therefore the
updated session with good model values is never persisted. And when the
next call arrives, the page is pulled back out of Redis/Http session
without the changes.

I had to do the following to get the wicket session to be stored in the
session within our Application:

ISerializer serializer = new JavaSerializer(getApplicationKey());
getFrameworkSettings().setSerializer(serializer);
getStoreSettings().setAsynchronous(false);
setPageManagerProvider(new DefaultPageManagerProvider(this) {
protected IPageStore newCachingStore(IPageStore pageStore)
{
return new CachingPageStore(pageStore, new InSessionPageStore( 2,
serializer));
}
});

The objects are updated in the session page object instance correctly with
AjaxFormComponentUpdatingBehavior , however this issue is they are never
saved/persisted as setAttribute is not called. So the next request comes
and a new page object instance is unserialized from the store without the
changes.

Is this a bug?