Do not create sessions in ServletTilesRequestContext
----------------------------------------------------

                 Key: TILES-207
                 URL: https://issues.apache.org/struts/browse/TILES-207
             Project: Tiles
          Issue Type: Improvement
          Components: tiles-core
    Affects Versions: 2.0.4
         Environment: CentOS 5, Struts 2 with Tiles 2 plugin
            Reporter: Neil Aggarwal
            Priority: Minor


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

Here is a patch to use getSession(false) instead:

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 @@
     /** [EMAIL PROTECTED] */
     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);
 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to