Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-528

Sessions.getOrCreateSession() returns a new Session for every call if no session cookie present

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.3.0.Beta10, 1.3.0.Beta11
    • 1.3.0.Beta9
    • None
    • None

    Description

      With this commit(1), calls to Sessions.getOrCreateSession() from
      within a handler where no session cookie was sent with the request
      result in a new Session being created every time, with the last
      Session created actually being the one stored when the exchange is
      completed.

      This means that the following in a handler results in "foo" not being
      in the session on the next request:

      Sessions.getOrCreateSession(exchange).setAttribute("foo", "bar");
      Sessions.getOrCreateSession(exchange);

      Before (1), the second getOrCreateSession() call would return the same
      Session object as the first call, not overwriting the one already
      attached to the request, and "foo" would be preserved.

      (1): https://github.com/undertow-io/undertow/commit/a97fec29f379fff6cb5a74ae9a39177a9c36d4ae

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            tcrawley Toby Crawley (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: