mcardle     2005/10/03 14:49:39 CEST

  Modified files:
    core/src/java/org/jahia/gui HTMLToolBox.java 
    core/src/test/etc/production 
                                 applicationcontext-basejahiaconfig.xml 
    core/src/java/org/jahia/ajax AjaxServlet.java 
  Added files:
    core/src/java/org/jahia/gui menuIdPropsBean.java 
  Log:
  * fix to support inter-session Action Menu property sharing, required for ESI 
caching 

  

  Stores all the properties associated with each Action Menu over all pages 
over all sites.

  These were originally stored in the Http session on a usage based 
granularity. However, this conflicted with ESI caching since menu properties 
weren't accessible between sessions.

  So we resolved to store them all in a singleton bean.
  
  Revision  Changes    Path
  1.8       +5 -3      jahia/core/src/java/org/jahia/ajax/AjaxServlet.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/ajax/AjaxServlet.java.diff?r1=1.7&r2=1.8&f=h
  1.29      +7 -5      jahia/core/src/java/org/jahia/gui/HTMLToolBox.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/gui/HTMLToolBox.java.diff?r1=1.28&r2=1.29&f=h
  1.1       +47 -0     jahia/core/src/java/org/jahia/gui/menuIdPropsBean.java 
(new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/gui/menuIdPropsBean.java?rev=1.1&content-type=text/plain
  1.2       +2 -1      
jahia/core/src/test/etc/production/applicationcontext-basejahiaconfig.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/test/etc/production/applicationcontext-basejahiaconfig.xml.diff?r1=1.1&r2=1.2&f=h
  
  
  
  Index: menuIdPropsBean.java
  ====================================================================
  package org.jahia.gui;
  
  import java.util.HashMap;
  
  /**
   * Stores all the properties associated with each Action Menu
   * over all pages over all sites.
   *
   * These were originally stored
   * in the Http session on a usage based granularity. However, this conflicted
   * with ESI caching since menu properties weren't accessible between sessions.
   * So we resolved to store them all in this singleton bean.
   *
   *
   * User: MC
   * Date: 03-Oct-2005
   * Time: 11:56:29
   *
   * */
  public class menuIdPropsBean {
      private static org.apache.log4j.Logger logger =
              org.apache.log4j.Logger.getLogger(menuIdPropsBean.class);
  
      HashMap menuIDprops = new HashMap();
  
      public menuIdPropsBean() {
         logger.debug("----- menuIdPropsBean initialized ------- ");
      }
  
      /**
       * store a hashmap containing all useful properties for a given Action 
Menu
       * @param menuID Action menu unique key
       * @param properties HashMap of user menu's properties
       */
      public void put(String menuID, HashMap properties) {
          menuIDprops.put(menuID, properties);
      }
  
      /**
       * return a hashmap containing all useful properties for a given Action 
Menu
       * @param menuID Action menu unique key
       * @return
       */
      public HashMap get(String menuID) {
          return (HashMap) menuIDprops.get(menuID);
      }
  }
  
  
  
  Index: HTMLToolBox.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/gui/HTMLToolBox.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- HTMLToolBox.java  29 Sep 2005 15:01:59 -0000      1.28
  +++ HTMLToolBox.java  3 Oct 2005 12:49:38 -0000       1.29
  @@ -49,6 +49,8 @@
   import org.jahia.services.pages.JahiaPageDefinition;
   import org.jahia.services.acl.JahiaBaseACL;
   import org.jahia.services.usermanager.JahiaUser;
  +import org.jahia.hibernate.manager.SpringContextSingleton;
  +import org.springframework.beans.factory.BeanFactory;
   
   import javax.servlet.http.HttpSession;
   import javax.servlet.jsp.JspWriter;
  @@ -58,6 +60,7 @@
   /**
    * 
    * Modified and cleaned by Xavier Lawrence
  + * MC modified and cleaned Xavier Lawrence
    */
   public class HTMLToolBox {
       
  @@ -1077,14 +1080,13 @@
           
           final HashMap props = new HashMap();
           props.put("useFieldSet", Boolean.valueOf(useFieldSet));
  -        props.put("namePostFix", namePostFix);
           props.put("resourceBundle", resourceBundle);
           props.put("lockIcon", lockIcon);
           
  -        final HttpSession theSession = ((ParamBean)jParams).getRequest().
  -                getSession();
  -        
  -        theSession.setAttribute(menuID, props);
  +        BeanFactory bf = SpringContextSingleton.getInstance().getContext();
  +        menuIdPropsBean menuIdProps = 
(menuIdPropsBean)bf.getBean("org.jahia.gui.menuIdPropsBean");
  +        menuIdProps.put(menuID, props);
  +
       }
       
       /**
  
  
  
  Index: applicationcontext-basejahiaconfig.xml
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/test/etc/production/applicationcontext-basejahiaconfig.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- applicationcontext-basejahiaconfig.xml    2 Sep 2005 10:26:24 -0000       
1.1
  +++ applicationcontext-basejahiaconfig.xml    3 Oct 2005 12:49:39 -0000       
1.2
  @@ -102,5 +102,6 @@
        </bean> 
   
        <bean id="org.jahia.params.ProcessingContextFactory" 
class="org.jahia.params.ProcessingContextFactoryImpl" />
  -     
  +
  +    <bean id="org.jahia.gui.menuIdPropsBean" 
class="org.jahia.gui.menuIdPropsBean" />
   </beans>
  
  
  
  Index: AjaxServlet.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/ajax/AjaxServlet.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AjaxServlet.java  26 Aug 2005 13:46:40 -0000      1.7
  +++ AjaxServlet.java  3 Oct 2005 12:49:39 -0000       1.8
  @@ -60,6 +60,7 @@
   import org.jahia.exceptions.JahiaException;
   import org.jahia.gui.GuiBean;
   import org.jahia.gui.HTMLToolBox;
  +import org.jahia.gui.menuIdPropsBean;
   import org.jahia.params.ParamBean;
   import org.jahia.params.ProcessingContext;
   import org.jahia.params.ProcessingContextFactory;
  @@ -339,9 +340,10 @@
           final HTMLToolBox box = new HTMLToolBox(gui, jParams);
           final Map result = new HashMap();
           
  -        final Map objectInfo = (Map)((ParamBean)jParams).getRequest().
  -                getSession().getAttribute(box.buildUniqueContentID(bean));
  -        
  +        BeanFactory bf = SpringContextSingleton.getInstance().getContext();
  +        menuIdPropsBean menuIdProps = 
(menuIdPropsBean)bf.getBean("org.jahia.gui.menuIdPropsBean");
  +        final Map objectInfo = (Map) 
menuIdProps.get(box.buildUniqueContentID(bean));
  +
           logger.debug("objectInfo for ContentBean " + bean.getID() + ": " +
                   objectInfo);
           
  

Reply via email to