haul        2002/12/18 08:52:50

  Modified:    src/java/org/apache/cocoon/components/language/markup/xsp
                        JSGenerator.java XSPRequestHelper.java
               src/java/org/apache/cocoon/components/language/markup/xsp/java
                        xsp.xsl
               src/java/org/apache/cocoon/components/language/markup/xsp/javascript
                        session.xsl
  Removed:     src/java/org/apache/cocoon/components/language/markup/xsp
                        XSPSessionHelper.java
               src/java/org/apache/cocoon/components/language/markup/xsp/java
                        session.xsl
  Log:
    <action dev="CH" type="add"due-to-email="[EMAIL PROTECTED]" 
due-to="Antonio Gallardo" fixes-bug="13070">
     Add a new tag xsp-session:getxml to XSP. In this course moved session.xsl
     for JAVA as well as XSPSessionHelper to session-fw block. Removed
     dependencies to XSPSessionHelper and moved functionality to XSPRequestHelper
     which already deals with session.
    </action>
  
  Revision  Changes    Path
  1.11      +10 -10    
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/JSGenerator.java
  
  Index: JSGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/JSGenerator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JSGenerator.java  5 Dec 2002 09:48:53 -0000       1.10
  +++ JSGenerator.java  18 Dec 2002 16:52:50 -0000      1.11
  @@ -309,6 +309,15 @@
           return XSPRequestHelper.getRequestedURL(this.objectModel);
       }
   
  +    public Object getSessionAttribute(String name, Object defaultValue) {
  +        return XSPRequestHelper.getSessionAttribute(this.objectModel, name, 
defaultValue);
  +    }
  +
  +    public String[] getSessionAttributeNames() {
  +        Collection c = XSPRequestHelper.getSessionAttributeNames(this.objectModel);
  +        return (String[])c.toArray(new String[c.size()]);
  +    }
  +
       // XSPResponseHelper
   
       public void responseGetLocale()
  @@ -356,13 +365,4 @@
           XSPResponseHelper.setDateHeader(this.response, name, date, format);
       }
   
  -    // XSPSessionHelper
  -    public Object getSessionAttribute(Session session, String name, Object 
defaultValue) {
  -        return XSPSessionHelper.getSessionAttribute(session, name, defaultValue);
  -    }
  -
  -    public String[] getSessionAttributeNames(Session session) {
  -        Collection c = XSPSessionHelper.getSessionAttributeNames(session);
  -        return (String[])c.toArray(new String[c.size()]);
  -    }
   }
  
  
  
  1.15      +42 -1     
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSPRequestHelper.java
  
  Index: XSPRequestHelper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSPRequestHelper.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XSPRequestHelper.java     21 Nov 2002 18:18:48 -0000      1.14
  +++ XSPRequestHelper.java     18 Dec 2002 16:52:50 -0000      1.15
  @@ -61,6 +61,7 @@
   import org.xml.sax.helpers.AttributesImpl;
   
   import java.util.ArrayList;
  +import java.util.List;
   import java.util.Date;
   import java.util.Enumeration;
   import java.util.Locale;
  @@ -561,5 +562,45 @@
   
           XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "parameter",
               getSessionAttribute(objectModel, name, defaultValue).toString(), attr);
  +    }
  +
  +    /**
  +     * Output session attribute names for a given request
  +     *
  +     * @param objectModel The Map objectModel
  +     * @param contentHandler The SAX content handler
  +     * @exception SAXException If a SAX error occurs
  +     */
  +    public static void getSessionAttributeNames(Map objectModel,
  +                                         ContentHandler contentHandler)
  +        throws SAXException {
  +        Request request = ObjectModelHelper.getRequest(objectModel);
  +        XSPObjectHelper.start(URI, PREFIX, contentHandler, "attribute-names");
  +
  +        Enumeration e = request.getSession().getAttributeNames();
  +        while (e.hasMoreElements()) {
  +            String name = (String) e.nextElement();
  +            XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "name", name);
  +        }
  +
  +        XSPObjectHelper.end(URI, PREFIX, contentHandler, "attribute-names");
  +    }
  +
  +    /**
  +     * Returns the session attribute names
  +     *
  +     * @param objectModel The Map objectModel
  +     */
  +    public static List getSessionAttributeNames(Map objectModel)
  +    {
  +        Request request = ObjectModelHelper.getRequest(objectModel);
  +
  +        ArrayList a = new ArrayList(10);
  +        Enumeration e = request.getSession().getAttributeNames();
  +        while (e.hasMoreElements()) {
  +            a.add(e.nextElement());
  +        }
  +
  +        return a;
       }
   }
  
  
  
  1.15      +2 -3      
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl
  
  Index: xsp.xsl
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- xsp.xsl   3 Dec 2002 16:44:09 -0000       1.14
  +++ xsp.xsl   18 Dec 2002 16:52:50 -0000      1.15
  @@ -121,7 +121,6 @@
       import org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper;
       import org.apache.cocoon.components.language.markup.xsp.XSPRequestHelper;
       import org.apache.cocoon.components.language.markup.xsp.XSPResponseHelper;
  -    import org.apache.cocoon.components.language.markup.xsp.XSPSessionHelper;
   
       /* User Imports */
       <xsl:for-each select="xsp:structure/xsp:include">
  
  
  
  1.5       +6 -6      
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/javascript/session.xsl
  
  Index: session.xsl
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/javascript/session.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- session.xsl       2 Aug 2002 02:04:36 -0000       1.4
  +++ session.xsl       18 Dec 2002 16:52:50 -0000      1.5
  @@ -128,14 +128,14 @@
         <xsl:when test="$as = 'xml'">
           <xsp-session:attribute>
             <xsp:expr>
  -            page.getSessionAttribute(session, String(<xsl:copy-of select="$name"/>),
  +            page.getSessionAttribute(String(<xsl:copy-of select="$name"/>),
                   <xsl:copy-of select="$default"/>)
             </xsp:expr>
           </xsp-session:attribute>
         </xsl:when>
         <xsl:when test="$as = 'object'">
           <xsp:expr>
  -          page.getSessionAttribute(session, String(<xsl:copy-of select="$name"/>),
  +          page.getSessionAttribute(String(<xsl:copy-of select="$name"/>),
                 <xsl:copy-of select="$default"/>)
           </xsp:expr>
         </xsl:when>
  @@ -152,7 +152,7 @@
       <xsl:choose>
         <xsl:when test="$as = 'xml'">
           <xsp:logic>
  -          _session_attribute_names_ = page.getSessionAttributeNames(session);
  +          _session_attribute_names_ = page.getSessionAttributeNames();
           </xsp:logic>
           <xsp-session:attribute-names>
             <xsp:logic>
  @@ -167,7 +167,7 @@
   
         <xsl:when test="$as = 'array'">
           <xsp:expr>
  -          page.getSessionAttributeNames(session)
  +          page.getSessionAttributeNames()
           </xsp:expr>
         </xsl:when>
       </xsl:choose>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to