Tiles
  1. Tiles
  2. TILES-207

Do not create sessions in ServletTilesRequestContext

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.5
    • Component/s: tiles-core
    • Labels:
      None
    • Environment:

      CentOS 5, Struts 2 with Tiles 2 plugin

    • Flags:
      Patch

      Description

      ServletTilesRequestContext calls request.getSession() instead of request.getSession(false) and will therefore create a new session if one does not exist. It should check an existing session, but should not create one.

      1. patch.diff
        8 kB
        Antonio Petrelli
      2. patch.diff
        13 kB
        Antonio Petrelli

        Issue Links

          Activity

          Hide
          Antonio Petrelli added a comment -

          Re-closed, whatever...
          What the.... who changed this issue to Resolved status???

          Show
          Antonio Petrelli added a comment - Re-closed, whatever... What the.... who changed this issue to Resolved status???
          Hide
          Antonio Petrelli added a comment -

          Issue closed due to the release of Tiles 2.0.5

          Show
          Antonio Petrelli added a comment - Issue closed due to the release of Tiles 2.0.5
          Hide
          Antonio Petrelli added a comment -

          Now the session is created only when necessary, i.e. when someone tries to add an attribute in session.

          Show
          Antonio Petrelli added a comment - Now the session is created only when necessary, i.e. when someone tries to add an attribute in session.
          Hide
          Antonio Petrelli added a comment -

          Updated the patch, to cover the possibility of creation of session by others.

          Show
          Antonio Petrelli added a comment - Updated the patch, to cover the possibility of creation of session by others.
          Hide
          Antonio Petrelli added a comment -

          Added a changed proposed patch, that shows how to create a session when needed.

          Show
          Antonio Petrelli added a comment - Added a changed proposed patch, that shows how to create a session when needed.
          Hide
          Antonio Petrelli added a comment -

          The proposed patch, submitted by Neil Aggarwal, is:

          Index: C:/JavaLibs/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java
          ===================================================================
          — C:/JavaLibs/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java (revision 572177)
          +++ C:/JavaLibs/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java (working copy)
          @@ -170,8 +170,8 @@
          /**

          {@inheritDoc}

          */
          public Map<String, Object> getSessionScope() {

          • if ((sessionScope == null) && (request != null)) {
          • sessionScope = new ServletSessionScopeMap(request.getSession());
            + if ((sessionScope == null) && (request != null) && (request.getSession(false) != null)) { + sessionScope = new ServletSessionScopeMap(request.getSession(false)); }

            return (sessionScope);

          Show
          Antonio Petrelli added a comment - The proposed patch, submitted by Neil Aggarwal, is: Index: C:/JavaLibs/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java =================================================================== — C:/JavaLibs/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java (revision 572177) +++ C:/JavaLibs/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java (working copy) @@ -170,8 +170,8 @@ /** {@inheritDoc} */ public Map<String, Object> getSessionScope() { if ((sessionScope == null) && (request != null)) { sessionScope = new ServletSessionScopeMap(request.getSession()); + if ((sessionScope == null) && (request != null) && (request.getSession(false) != null)) { + sessionScope = new ServletSessionScopeMap(request.getSession(false)); } return (sessionScope);

            People

            • Assignee:
              Antonio Petrelli
              Reporter:
              Neil Aggarwal
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development