svn commit: r670268 - in /ofbiz/trunk/framework: base/dtd/ base/src/base/org/ofbiz/base/component/ catalina/src/org/ofbiz/catalina/container/ webapp/src/org/ofbiz/webapp/control/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r670268 - in /ofbiz/trunk/framework: base/dtd/ base/src/base/org/ofbiz/base/component/ catalina/src/org/ofbiz/catalina/container/ webapp/src/org/ofbiz/webapp/control/

jleroux@apache.org
Author: jleroux
Date: Sat Jun 21 16:02:59 2008
New Revision: 670268

URL: http://svn.apache.org/viewvc?rev=670268&view=rev
Log:
A patch from Michael Brohl "Configure cookie use for a module through the ofbiz-component.xml" (https://issues.apache.org/jira/browse/OFBIZ-1831) - OFBIZ-1831

Modified:
    ofbiz/trunk/framework/base/dtd/ofbiz-component.xsd
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/component/ComponentConfig.java
    ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java

Modified: ofbiz/trunk/framework/base/dtd/ofbiz-component.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/dtd/ofbiz-component.xsd?rev=670268&r1=670267&r2=670268&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/dtd/ofbiz-component.xsd (original)
+++ ofbiz/trunk/framework/base/dtd/ofbiz-component.xsd Sat Jun 21 16:02:59 2008
@@ -199,6 +199,14 @@
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>
+        <xs:attribute name="session-cookie-accepted" default="true">
+            <xs:simpleType>
+                <xs:restriction base="xs:token">
+                    <xs:enumeration value="true"/>
+                    <xs:enumeration value="false"/>
+                </xs:restriction>
+            </xs:simpleType>
+        </xs:attribute>
     </xs:attributeGroup>
     <xs:element name="virtual-host">
         <xs:complexType>

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/component/ComponentConfig.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/component/ComponentConfig.java?rev=670268&r1=670267&r2=670268&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/component/ComponentConfig.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/component/ComponentConfig.java Sat Jun 21 16:02:59 2008
@@ -679,6 +679,7 @@
         public String[] basePermission;
         public String position;        
         public boolean appBarDisplay;
+        public boolean sessionCookieAccepted;
 
         public WebappInfo(ComponentConfig componentConfig, Element element) {
          this.virtualHosts = FastList.newInstance();
@@ -691,6 +692,7 @@
             this.mountPoint = element.getAttribute("mount-point");
             this.location = element.getAttribute("location");
             this.appBarDisplay = !"false".equals(element.getAttribute("app-bar-display"));
+            this.sessionCookieAccepted = !"false".equals(element.getAttribute("session-cookie-accepted"));
             String basePermStr = element.getAttribute("base-permission");
             if (UtilValidate.isNotEmpty(basePermStr)) {
                 this.basePermission = basePermStr.split(",");
@@ -794,5 +796,9 @@
         public Map<String, String> getInitParameters() {
             return initParameters;
         }
+        
+        public boolean isSessionCookieAccepted() {
+            return sessionCookieAccepted;
+        }
     }
 }

Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=670268&r1=670267&r2=670268&view=diff
==============================================================================
--- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original)
+++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Sat Jun 21 16:02:59 2008
@@ -509,6 +509,9 @@
         context.setJ2EEApplication(J2EE_APP);
         context.setJ2EEServer(J2EE_SERVER);
         context.setLoader(embedded.createLoader(ClassLoaderContainer.getClassLoader()));
+        
+        context.setCookies(appInfo.isSessionCookieAccepted());
+        context.addParameter("cookies", appInfo.isSessionCookieAccepted() ? "true" : "false");
 
         context.setDisplayName(appInfo.name);
         context.setDocBase(location);

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=670268&r1=670267&r2=670268&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Sat Jun 21 16:02:59 2008
@@ -809,7 +809,7 @@
 
         String encodedUrl;
         if (encode) {
-            boolean forceManualJsessionid = false;
+            boolean forceManualJsessionid = "false".equals(getServletContext().getInitParameter("cookies")) ? true : false;
             boolean isSpider = false;
             
             // if the current request comes from a spider, we will not add the jsessionid to the link