geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1341377 - in /geronimo/server/branches/3.0-beta/plugins: j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/ j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/ jetty8/geronimo-jetty8-builder/src/mai...
Date Tue, 22 May 2012 09:45:20 GMT
Author: xuhaihong
Date: Tue May 22 09:45:19 2012
New Revision: 1341377

URL: http://svn.apache.org/viewvc?rev=1341377&view=rev
Log:
GERONIMO-6352 Set session configurations while they are explicitly configured

Modified:
    geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
    geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java
    geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java
    geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
    geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java
    geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/BaseGeronimoContextConfig.java

Modified: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java?rev=1341377&r1=1341376&r2=1341377&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
Tue May 22 09:45:19 2012
@@ -254,21 +254,21 @@ public class WebAppInfoBuilder {
 
         for (SessionConfig sessionConfig: webApp.getSessionConfig()) {
             SessionConfigInfo sessionConfigInfo = new SessionConfigInfo();
-            sessionConfigInfo.sessionTimeoutMinutes = sessionConfig.getSessionTimeout() !=
null? sessionConfig.getSessionTimeout(): -1;
+            sessionConfigInfo.sessionTimeoutMinutes = sessionConfig.getSessionTimeout() !=
null? sessionConfig.getSessionTimeout(): null;
             List<SessionTrackingMode> modes = new ArrayList<SessionTrackingMode>();
             for (TrackingMode mode: sessionConfig.getTrackingMode()) {
                 modes.add(SessionTrackingMode.valueOf(mode.value()));
             }
-            sessionConfigInfo.sessionTrackingModes = modes.isEmpty()? EnumSet.noneOf(SessionTrackingMode.class):
EnumSet.copyOf(modes);
+            sessionConfigInfo.sessionTrackingModes = modes.isEmpty() ? null : EnumSet.copyOf(modes);
             if (sessionConfig.getCookieConfig() != null) {
                 SessionCookieConfigInfo cookieConfigInfo = new SessionCookieConfigInfo();
                 cookieConfigInfo.name = sessionConfig.getCookieConfig().getName();
                 cookieConfigInfo.domain = sessionConfig.getCookieConfig().getDomain();
                 cookieConfigInfo.comment = sessionConfig.getCookieConfig().getComment();
                 cookieConfigInfo.path = sessionConfig.getCookieConfig().getPath();
-                cookieConfigInfo.httpOnly = sessionConfig.getCookieConfig().getHttpOnly()
!= null? sessionConfig.getCookieConfig().getHttpOnly(): false;
-                cookieConfigInfo.secure = sessionConfig.getCookieConfig().getSecure() !=
null? sessionConfig.getCookieConfig().getSecure(): false;
-                cookieConfigInfo.maxAge = sessionConfig.getCookieConfig().getMaxAge() !=
null? sessionConfig.getCookieConfig().getMaxAge(): -1;
+                cookieConfigInfo.httpOnly = sessionConfig.getCookieConfig().getHttpOnly()
!= null? sessionConfig.getCookieConfig().getHttpOnly(): null;
+                cookieConfigInfo.secure = sessionConfig.getCookieConfig().getSecure() !=
null? sessionConfig.getCookieConfig().getSecure(): null;
+                cookieConfigInfo.maxAge = sessionConfig.getCookieConfig().getMaxAge() !=
null? sessionConfig.getCookieConfig().getMaxAge(): null;
                 sessionConfigInfo.sessionCookieConfig = cookieConfigInfo;
             }
             webAppInfo.sessionConfig = sessionConfigInfo;

Modified: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java?rev=1341377&r1=1341376&r2=1341377&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java
Tue May 22 09:45:19 2012
@@ -30,7 +30,7 @@ import javax.servlet.SessionTrackingMode
  */
 public class SessionConfigInfo implements Serializable{
 
-    public int sessionTimeoutMinutes;
+    public Integer sessionTimeoutMinutes;
     public SessionCookieConfigInfo sessionCookieConfig;
     public EnumSet<SessionTrackingMode> sessionTrackingModes;
 

Modified: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java?rev=1341377&r1=1341376&r2=1341377&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java
Tue May 22 09:45:19 2012
@@ -31,7 +31,7 @@ public class SessionCookieConfigInfo imp
     public String comment;
     public String domain;
     public String path;
-    public boolean httpOnly;
-    public boolean secure;
-    public int maxAge;
+    public Boolean httpOnly;
+    public Boolean secure;
+    public Integer maxAge;
 }

Modified: geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java?rev=1341377&r1=1341376&r2=1341377&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
Tue May 22 09:45:19 2012
@@ -493,7 +493,7 @@ public class JettyModuleBuilder extends 
 
             //TODO merge from default web app
             if (webAppInfo.sessionConfig != null) {
-                if (webAppInfo.sessionConfig.sessionTimeoutMinutes == -1 && defaultSessionTimeoutMinutes
!= -1) {
+                if (webAppInfo.sessionConfig.sessionTimeoutMinutes == null && defaultSessionTimeoutMinutes
!= -1) {
                     webAppInfo.sessionConfig.sessionTimeoutMinutes = defaultSessionTimeoutMinutes;
                 }
             }

Modified: geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java?rev=1341377&r1=1341376&r2=1341377&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java
Tue May 22 09:45:19 2012
@@ -61,6 +61,7 @@ import org.apache.geronimo.security.jacc
 import org.apache.geronimo.transaction.GeronimoUserTransaction;
 import org.apache.geronimo.web.WebApplicationConstants;
 import org.apache.geronimo.web.info.ErrorPageInfo;
+import org.apache.geronimo.web.info.SessionCookieConfigInfo;
 import org.apache.geronimo.web.info.WebAppInfo;
 import org.eclipse.jetty.http.MimeTypes;
 import org.eclipse.jetty.security.SecurityHandler;
@@ -285,19 +286,36 @@ public class WebAppContextWrapper implem
 
         if (!webAppInfo.distributable && webAppInfo.sessionConfig != null) {
             SessionManager sessionManager = this.webAppContext.getSessionHandler().getSessionManager();
-            if (webAppInfo.sessionConfig.sessionTimeoutMinutes != -1) {
+            if (webAppInfo.sessionConfig.sessionTimeoutMinutes != null) {
                 sessionManager.setMaxInactiveInterval(webAppInfo.sessionConfig.sessionTimeoutMinutes
* 60);
             }
-            sessionManager.setSessionTrackingModes(webAppInfo.sessionConfig.sessionTrackingModes);
-            if (webAppInfo.sessionConfig.sessionCookieConfig != null) {
+            if (webAppInfo.sessionConfig.sessionTrackingModes != null) {
+                sessionManager.setSessionTrackingModes(webAppInfo.sessionConfig.sessionTrackingModes);
+            }
+            SessionCookieConfigInfo sessionCookieConfigInfo = webAppInfo.sessionConfig.sessionCookieConfig;
+            if (sessionCookieConfigInfo != null) {
                 SessionCookieConfig cookieConfig = sessionManager.getSessionCookieConfig();
-                cookieConfig.setName(webAppInfo.sessionConfig.sessionCookieConfig.name);
-                cookieConfig.setPath(webAppInfo.sessionConfig.sessionCookieConfig.path);
-                cookieConfig.setDomain(webAppInfo.sessionConfig.sessionCookieConfig.domain);
-                cookieConfig.setComment(webAppInfo.sessionConfig.sessionCookieConfig.comment);
-                cookieConfig.setHttpOnly(webAppInfo.sessionConfig.sessionCookieConfig.httpOnly);
-                cookieConfig.setSecure(webAppInfo.sessionConfig.sessionCookieConfig.secure);
-                cookieConfig.setMaxAge(webAppInfo.sessionConfig.sessionCookieConfig.maxAge);
+                if (sessionCookieConfigInfo.name != null) {
+                    cookieConfig.setName(sessionCookieConfigInfo.name);
+                }
+                if (sessionCookieConfigInfo.comment != null) {
+                    cookieConfig.setComment(sessionCookieConfigInfo.comment);
+                }
+                if (sessionCookieConfigInfo.domain != null) {
+                    cookieConfig.setDomain(sessionCookieConfigInfo.domain);
+                }
+                if (sessionCookieConfigInfo.httpOnly != null) {
+                    cookieConfig.setHttpOnly(sessionCookieConfigInfo.httpOnly);
+                }
+                if (sessionCookieConfigInfo.maxAge != null) {
+                    cookieConfig.setMaxAge(sessionCookieConfigInfo.maxAge);
+                }
+                if (sessionCookieConfigInfo.path != null) {
+                    cookieConfig.setPath(sessionCookieConfigInfo.path);
+                }
+                if (sessionCookieConfigInfo.secure != null) {
+                    cookieConfig.setSecure(sessionCookieConfigInfo.secure);
+                }
             }
         }
         //supply web.xml to jasper

Modified: geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/BaseGeronimoContextConfig.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/BaseGeronimoContextConfig.java?rev=1341377&r1=1341376&r2=1341377&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/BaseGeronimoContextConfig.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/BaseGeronimoContextConfig.java
Tue May 22 09:45:19 2012
@@ -116,19 +116,35 @@ public abstract class BaseGeronimoContex
         authenticatorConfig(webAppInfo.loginConfig);
         if (webAppInfo.sessionConfig != null) {
             SessionConfigInfo sessionConfig = webAppInfo.sessionConfig;
-            context.setSessionTimeout(sessionConfig.sessionTimeoutMinutes);
+            if (sessionConfig.sessionTimeoutMinutes != null) {
+                context.setSessionTimeout(sessionConfig.sessionTimeoutMinutes);
+            }
             if (sessionConfig.sessionTrackingModes != null) {
                 servletContext.setSessionTrackingModes(sessionConfig.sessionTrackingModes);
             }
             if (sessionConfig.sessionCookieConfig != null) {
                 SessionCookieConfig sessionCookieConfig = servletContext.getSessionCookieConfig();
-                sessionCookieConfig.setName(sessionConfig.sessionCookieConfig.name);
-                sessionCookieConfig.setComment(sessionConfig.sessionCookieConfig.comment);
-                sessionCookieConfig.setDomain(sessionConfig.sessionCookieConfig.domain);
-                sessionCookieConfig.setHttpOnly(sessionConfig.sessionCookieConfig.httpOnly);
-                sessionCookieConfig.setMaxAge(sessionConfig.sessionCookieConfig.maxAge);
-                sessionCookieConfig.setPath(sessionConfig.sessionCookieConfig.path);
-                sessionCookieConfig.setSecure(sessionConfig.sessionCookieConfig.secure);
+                if (sessionConfig.sessionCookieConfig.name != null) {
+                    sessionCookieConfig.setName(sessionConfig.sessionCookieConfig.name);
+                }
+                if (sessionConfig.sessionCookieConfig.comment != null) {
+                    sessionCookieConfig.setComment(sessionConfig.sessionCookieConfig.comment);
+                }
+                if (sessionConfig.sessionCookieConfig.domain != null) {
+                    sessionCookieConfig.setDomain(sessionConfig.sessionCookieConfig.domain);
+                }
+                if (sessionConfig.sessionCookieConfig.httpOnly != null) {
+                    sessionCookieConfig.setHttpOnly(sessionConfig.sessionCookieConfig.httpOnly);
+                }
+                if (sessionConfig.sessionCookieConfig.maxAge != null) {
+                    sessionCookieConfig.setMaxAge(sessionConfig.sessionCookieConfig.maxAge);
+                }
+                if (sessionConfig.sessionCookieConfig.path != null) {
+                    sessionCookieConfig.setPath(sessionConfig.sessionCookieConfig.path);
+                }
+                if (sessionConfig.sessionCookieConfig.secure != null) {
+                    sessionCookieConfig.setSecure(sessionConfig.sessionCookieConfig.secure);
+                }
             }
         }
         context.setConfigured(true);



Mime
View raw message