Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-2308

Don't create HttpSession when persisted property is null

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.11
    • Fix Version/s: 5.0.12
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      When persisting properties using "session" it would be nice if the session was only created after a non-null value was assigned to the property.

      It should be enough to add a simple guard in AbstractSessionPersistentFieldStrategy#postChange

      Session session = _request.getSession(newValue != null);
      if (session != null)

      { session.setAttribute(builder.toString(), newValue); }

      allowing existing session values to be replaced if the session exists, but not storing a value if no session exists.

        Attachments

          Activity

            People

            • Assignee:
              hlship Howard M. Lewis Ship
              Reporter:
              joshcanfield Josh Canfield
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: