You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Trejkaz <tr...@trypticon.org> on 2017/03/27 01:19:32 UTC

As of Wicket 6.something, info messages now wiped out during redirect?

Hi all.

Next problem in the list. :(

Most of our forms finish up their work like this:

    info("Successfully did something")
    setResponsePage(SomePage.class);

And in the tests we check it like this:

    tester.assertRenderedPage(SomePage.class);
    tester.assertInfoMessages("Successfully did something");

After updating to Wicket 6.26.0, this test now fails because there are
supposedly no info messages.
I tried 6.13.0 and got the same result there.

Investigation:
* This time the real application does exhibit the issue.
* A breakpoint in the IFeedbackMessageFilter verifies that it does get
called and that every single call returns false.

At this point I can't figure out why the messages are being deleted so
again, asking here whether we're doing something wrong, or whether
this is a bug.

Demo code here: https://github.com/trejkaz/wicket-feedback-problems

TX

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


Re: As of Wicket 6.something, info messages now wiped out during redirect?

Posted by Martin Grigorov <mg...@apache.org>.
You may find
https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+6.0
useful.
It has an entry about this change:
https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+6.0#MigrationtoWicket6.0-FeedbackStorageRefactoring
Unfortunately this migration guide is not very detailed. It misses some
changes :-/

https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+7.0
and
https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+8.0
are much better!


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

On Mon, Mar 27, 2017 at 8:35 AM, Trejkaz <tr...@trypticon.org> wrote:

> On Mon, Mar 27, 2017 at 5:27 PM, Martin Grigorov <mg...@apache.org>
> wrote:
> > The only way I see is to
> > override org.apache.wicket.Component#getFeedbackMessages() to delegate
> > to org.apache.wicket.Session#getFeedbackMessages() but you will have to
> do
> > this for each and every component ...
> > Maybe it would be better to update your application code.
>
> I don't know about better... (multiple places now have to call
> getSession().info() where info() previously worked correctly)
>
> But it's at least a solution.
>
> TX
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: As of Wicket 6.something, info messages now wiped out during redirect?

Posted by Trejkaz <tr...@trypticon.org>.
On Mon, Mar 27, 2017 at 5:27 PM, Martin Grigorov <mg...@apache.org> wrote:
> The only way I see is to
> override org.apache.wicket.Component#getFeedbackMessages() to delegate
> to org.apache.wicket.Session#getFeedbackMessages() but you will have to do
> this for each and every component ...
> Maybe it would be better to update your application code.

I don't know about better... (multiple places now have to call
getSession().info() where info() previously worked correctly)

But it's at least a solution.

TX

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


Re: As of Wicket 6.something, info messages now wiped out during redirect?

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Mar 27, 2017 at 7:54 AM, Trejkaz <tr...@trypticon.org> wrote:

> On Mon, Mar 27, 2017 at 4:42 PM, Sebastien <se...@gmail.com> wrote:
> > Hi,
> >
> > Yes, the message is lost. For such a use case, you have to use
> > Session.get().info(), so your message remains available after the
> redirect.
>
> I see... so looking at the info() method itself, on v1.5, info() goes
> into the session. But in v6, it goes into the component... which seems
> like it would always be lost.
>
> Is there some way to rewire such that info() still stores it in the
> session?
>

The only way I see is to
override org.apache.wicket.Component#getFeedbackMessages() to delegate
to org.apache.wicket.Session#getFeedbackMessages() but you will have to do
this for each and every component ...
Maybe it would be better to update your application code.


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

Re: As of Wicket 6.something, info messages now wiped out during redirect?

Posted by Trejkaz <tr...@trypticon.org>.
On Mon, Mar 27, 2017 at 4:42 PM, Sebastien <se...@gmail.com> wrote:
> Hi,
>
> Yes, the message is lost. For such a use case, you have to use
> Session.get().info(), so your message remains available after the redirect.

I see... so looking at the info() method itself, on v1.5, info() goes
into the session. But in v6, it goes into the component... which seems
like it would always be lost.

Is there some way to rewire such that info() still stores it in the session?

TX

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


Re: As of Wicket 6.something, info messages now wiped out during redirect?

Posted by Sebastien <se...@gmail.com>.
Hi,

Yes, the message is lost. For such a use case, you have to use
Session.get().info(), so your message remains available after the redirect.

Best regards,
Sebastien

On Mar 27, 2017 03:19, "Trejkaz" <tr...@trypticon.org> wrote:

> Hi all.
>
> Next problem in the list. :(
>
> Most of our forms finish up their work like this:
>
>     info("Successfully did something")
>     setResponsePage(SomePage.class);
>
> And in the tests we check it like this:
>
>     tester.assertRenderedPage(SomePage.class);
>     tester.assertInfoMessages("Successfully did something");
>
> After updating to Wicket 6.26.0, this test now fails because there are
> supposedly no info messages.
> I tried 6.13.0 and got the same result there.
>
> Investigation:
> * This time the real application does exhibit the issue.
> * A breakpoint in the IFeedbackMessageFilter verifies that it does get
> called and that every single call returns false.
>
> At this point I can't figure out why the messages are being deleted so
> again, asking here whether we're doing something wrong, or whether
> this is a bug.
>
> Demo code here: https://github.com/trejkaz/wicket-feedback-problems
>
> TX
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>