Wicket
  1. Wicket
  2. WICKET-5165

Session should be bound when adding messages to it

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.7.0
    • Fix Version/s: 6.9.0, 7.0.0-M1
    • Component/s: None
    • Labels:

      Description

      When using the Sessions info(), error() and success() methods, and the session is temporary, the messages can be dropped silently. This happens when on stateless pages and a redirect happens in the same request during which a session message is added.

      The fix for this could be to make sure the session is bound and call Session#bind() automatically when a session message is added.

      Email thread:
      http://wicket-users.markmail.org/thread/zd72s4gwnlp5d7ch

        Activity

        Bertrand Guay-Paquet created issue -
        Hide
        Martin Grigorov added a comment -

        If there is no redirect to another page then there is no need to bind the session, right ?

        Show
        Martin Grigorov added a comment - If there is no redirect to another page then there is no need to bind the session, right ?
        Hide
        Bertrand Guay-Paquet added a comment -

        That is correct.

        Show
        Bertrand Guay-Paquet added a comment - That is correct.
        Hide
        Martin Grigorov added a comment -

        And this makes the decision whether to bind the session not so easy :-/

        Show
        Martin Grigorov added a comment - And this makes the decision whether to bind the session not so easy :-/
        Hide
        Bertrand Guay-Paquet added a comment -

        Here's an idea that might work without concurrent request cycles:

        Session gets a new flag called "wasBoundForMessage" to indicate that the current session was bound during this request specifically for a session message. That flag is reset anytime the bind() method is called for another reason. At the end of a request, if wasBoundForMessage is true and the response is rendered in the same request (no redirect), the Session is "unbound".

        Like I said, I know this doesn't work as is, but I'm posting it in case the concept sparks another idea.

        Show
        Bertrand Guay-Paquet added a comment - Here's an idea that might work without concurrent request cycles: Session gets a new flag called "wasBoundForMessage" to indicate that the current session was bound during this request specifically for a session message. That flag is reset anytime the bind() method is called for another reason. At the end of a request, if wasBoundForMessage is true and the response is rendered in the same request (no redirect), the Session is "unbound". Like I said, I know this doesn't work as is, but I'm posting it in case the concept sparks another idea.
        Martin Grigorov made changes -
        Field Original Value New Value
        Assignee Martin Grigorov [ mgrigorov ]
        Hide
        Martin Grigorov added a comment -

        Fixed by checking for session feedback messages before making a redirect.

        Show
        Martin Grigorov added a comment - Fixed by checking for session feedback messages before making a redirect.
        Martin Grigorov made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 6.9.0 [ 12324357 ]
        Fix Version/s 7.0.0 [ 12322958 ]
        Resolution Fixed [ 1 ]
        Hide
        Bertrand Guay-Paquet added a comment -

        The fix looks nice and simple. Thanks!

        Show
        Bertrand Guay-Paquet added a comment - The fix looks nice and simple. Thanks!

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Bertrand Guay-Paquet
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development