cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp XSPCookieHelper.java XSPObjectHelper.java XSPRequestHelper.java XSPResponseHelper.java
Date Thu, 14 Jun 2001 15:11:39 GMT
bloritsch    01/06/14 08:11:39

  Modified:    .        Tag: cocoon_20_branch changes.xml
               src/org/apache/cocoon Tag: cocoon_20_branch Constants.java
               src/org/apache/cocoon/components/language/markup/xsp Tag:
                        cocoon_20_branch XSPCookieHelper.java
                        XSPObjectHelper.java XSPRequestHelper.java
                        XSPResponseHelper.java
  Log:
  Bug Fix for BUG 2166
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.7   +6 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.2.2.6
  retrieving revision 1.2.2.7
  diff -u -r1.2.2.6 -r1.2.2.7
  --- changes.xml	2001/06/14 14:44:04	1.2.2.6
  +++ changes.xml	2001/06/14 15:11:30	1.2.2.7
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: changes.xml,v 1.2.2.6 2001/06/14 14:44:04 bloritsch Exp $
  +  $Id: changes.xml,v 1.2.2.7 2001/06/14 15:11:30 bloritsch Exp $
   -->
   
   <changes title="History of Changes">
  @@ -24,6 +24,11 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="BL" type="fix" bug="2166">
  +    Made sure the _static_ classes did not inherit from each other,
  +    and made all calls to XSPObjectHelper that handled XML elements
  +    explicitly call with URI and PREFIX as parameters to the methods.
  +  </action>
     <action dev="BL" type="fix" bug="2142">
       Applied fix to URLFactoryImpl donated by wangtun@staff.yam.com.
     </action>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +3 -1      xml-cocoon2/src/org/apache/cocoon/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Constants.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- Constants.java	2001/05/25 22:00:47	1.4
  +++ Constants.java	2001/06/14 15:11:32	1.4.2.1
  @@ -10,7 +10,7 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4 $ $Date: 2001/05/25 22:00:47 $
  + * @version CVS $Revision: 1.4.2.1 $ $Date: 2001/06/14 15:11:32 $
    */
   
   public interface Constants {
  @@ -41,6 +41,8 @@
       String XSP_REQUEST_URI     = XSP_URI + "/request/2.0";
       String XSP_RESPONSE_PREFIX = "xsp-response";
       String XSP_RESPONSE_URI    = XSP_URI + "/response/2.0";
  +    String XSP_COOKIE_PREFIX  = "xsp-cookie";
  +    String XSP_COOKIE_URI     = XSP_URI + "/cookie/2.0";
   
       String XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +10 -13    xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPCookieHelper.java
  
  Index: XSPCookieHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPCookieHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- XSPCookieHelper.java	2001/05/31 17:37:57	1.2
  +++ XSPCookieHelper.java	2001/06/14 15:11:34	1.2.2.1
  @@ -54,11 +54,8 @@
     /**
      * Assign values to the object's namespace uri and prefix
      */
  -  /*static {
  -    URI = Constants.XSP_COOKIE_URI;
  -    PREFIX = Constants.XSP_COOKIE_PREFIX;
  -  }
  -  */
  +  private static final String URI = Constants.XSP_COOKIE_URI;
  +  private static final String PREFIX = Constants.XSP_COOKIE_PREFIX;
   
     /**
           This method will set a new cookie with values that are passed through paramaters
  @@ -173,11 +170,11 @@
   
           if(cookies.length > 0)
           {
  -            start(contentHandler, "cookies");
  +            XSPObjectHelper.start(URI, PREFIX, contentHandler, "cookies");
   
               for(count=0; count<cookies.length; count++)
               {
  -                start(contentHandler, "cookie");
  +                XSPObjectHelper.start(URI, PREFIX, contentHandler, "cookie");
   
                   if ((tempStr = getName(objectModel , null , count)) != null)
                       nodeTable.put("name", tempStr);
  @@ -208,13 +205,13 @@
                   {
                       String nodeName = (String)keys.nextElement();
                       String nodeValue = (String)nodeTable.get(nodeName);
  -                    elementData(contentHandler, nodeName, nodeValue);
  +                    XSPObjectHelper.elementData(URI, PREFIX, contentHandler, nodeName,
nodeValue);
                   }
   
  -                end(contentHandler, "cookie");
  +                XSPObjectHelper.end(URI, PREFIX, contentHandler, "cookie");
               }
   
  -            end(contentHandler, "cookies");
  +            XSPObjectHelper.end(URI, PREFIX, contentHandler, "cookies");
           }
   
       }
  @@ -343,7 +340,7 @@
   
           if (tempStr !=null)
           {
  -            start(contentHandler, "cookie");
  +            XSPObjectHelper.start(URI, PREFIX, contentHandler, "cookie");
   
               // name
               nodeTable.put("name", tempStr);
  @@ -381,10 +378,10 @@
               {
                   String nodeName = (String)keys.nextElement();
                   String nodeValue = (String)nodeTable.get(nodeName);
  -                elementData(contentHandler, nodeName, nodeValue);
  +                XSPObjectHelper.elementData(URI, PREFIX, contentHandler, nodeName, nodeValue);
               }
   
  -            end(contentHandler, "cookie");
  +            XSPObjectHelper.end(URI, PREFIX, contentHandler, "cookie");
   
           }
       }
  
  
  
  1.1.1.1.2.1 +13 -20    xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPObjectHelper.java
  
  Index: XSPObjectHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPObjectHelper.java,v
  retrieving revision 1.1.1.1
  retrieving revision 1.1.1.1.2.1
  diff -u -r1.1.1.1 -r1.1.1.1.2.1
  --- XSPObjectHelper.java	2001/05/09 20:49:52	1.1.1.1
  +++ XSPObjectHelper.java	2001/06/14 15:11:34	1.1.1.1.2.1
  @@ -22,7 +22,7 @@
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="sylvain.wallez@anyware-tech.com">Sylvain Wallez</a>
    *         (Cocoon1 <code>xspExpr()</code> methods port)
  - * @version CVS $Revision: 1.1.1.1 $ $Date: 2001/05/09 20:49:52 $
  + * @version CVS $Revision: 1.1.1.1.2.1 $ $Date: 2001/06/14 15:11:34 $
    */
   public class XSPObjectHelper {
     /**
  @@ -31,29 +31,22 @@
     protected static final AttributesImpl emptyAttr = new AttributesImpl();
   
     /**
  -   * Uri and prefix associated with object helper. Derived classes must assign
  -   * these variables to their proper values
  -   */
  -  protected static String URI;
  -  protected static String PREFIX;
  -
  -  /**
      * Output an element containing text only and no attributes
      *
      * @param contentHandler The SAX content handler
      * @param name The element name
      * @param data The data contained by the element
      */
  -  protected static void elementData(
  +  protected static void elementData(String uri, String prefix,
       ContentHandler contentHandler,
       String name,
       String data
     )
       throws SAXException
     {
  -    start(contentHandler, name);
  +    start(uri, prefix, contentHandler, name);
       data(contentHandler, data);
  -    end(contentHandler, name);
  +    end(uri, prefix, contentHandler, name);
     }
   
     /**
  @@ -64,7 +57,7 @@
      * @param data The data contained by the element
      * @param attr The element attributes
      */
  -  protected static void elementData(
  +  protected static void elementData(String uri, String prefix,
       ContentHandler contentHandler,
       String name,
       String data,
  @@ -72,9 +65,9 @@
     )
       throws SAXException
     {
  -    start(contentHandler, name, attr);
  +    start(uri, prefix, contentHandler, name, attr);
       data(contentHandler, data);
  -    end(contentHandler, name);
  +    end(uri, prefix, contentHandler, name);
     }
   
     /**
  @@ -84,13 +77,13 @@
      * @param contentHandler The SAX content handler
      * @param name The element name
      */
  -  protected static void start(
  +  protected static void start(String uri, String prefix,
       ContentHandler contentHandler,
       String name
     )
       throws SAXException
     {
  -    contentHandler.startElement(URI, name, PREFIX + ":" + name, emptyAttr);
  +    contentHandler.startElement(uri, name, prefix + ":" + name, emptyAttr);
     }
   
     /**
  @@ -101,14 +94,14 @@
      * @param name The element name
      * @param attr The element attributes
      */
  -  protected static void start(
  +  protected static void start(String uri, String prefix,
       ContentHandler contentHandler,
       String name,
       AttributesImpl attr
     )
       throws SAXException
     {
  -    contentHandler.startElement(URI, name, PREFIX + ":" + name, attr);
  +    contentHandler.startElement(uri, name, prefix + ":" + name, attr);
     }
   
     /**
  @@ -117,13 +110,13 @@
      * @param contentHandler The SAX content handler
      * @param name The element name
      */
  -  protected static void end(
  +  protected static void end(String uri, String prefix,
       ContentHandler contentHandler,
       String name
     )
       throws SAXException
     {
  -    contentHandler.endElement(URI, name, PREFIX + ":" + name);
  +    contentHandler.endElement(uri, name, prefix + ":" + name);
     }
   
     /**
  
  
  
  1.5.2.1   +36 -32    xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPRequestHelper.java
  
  Index: XSPRequestHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPRequestHelper.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- XSPRequestHelper.java	2001/05/31 17:37:58	1.5
  +++ XSPRequestHelper.java	2001/06/14 15:11:35	1.5.2.1
  @@ -22,16 +22,14 @@
    * The <code>Request</code> object helper
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.5 $ $Date: 2001/05/31 17:37:58 $
  + * @version CVS $Revision: 1.5.2.1 $ $Date: 2001/06/14 15:11:35 $
    */
  -public class XSPRequestHelper extends XSPObjectHelper {
  +public class XSPRequestHelper {
     /**
      * Assign values to the object's namespace uri and prefix
      */
  -  static {
  -    URI = Constants.XSP_REQUEST_URI;
  -    PREFIX = Constants.XSP_REQUEST_PREFIX;
  -  }
  +  private static final String URI = Constants.XSP_REQUEST_URI;
  +  private static final String PREFIX = Constants.XSP_REQUEST_PREFIX;
   
     /**
      * Output the uri associated with the given <code>Request</code>
  @@ -47,7 +45,7 @@
       throws SAXException
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -    elementData(contentHandler, "request-uri", request.getRequestURI());
  +    XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "request-uri", request.getRequestURI());
     }
   
     /**
  @@ -74,7 +72,7 @@
     )
         throws SAXException
     {
  -    elementData(handler, "uri", getURI(objectModel));
  +    XSPObjectHelper.elementData(URI, PREFIX, handler, "uri", getURI(objectModel));
     }
   
     /**
  @@ -94,7 +92,7 @@
      */
     public static void getSitemapURI(Map objectModel, ContentHandler handler)
         throws SAXException {
  -    elementData(handler, "sitemap-uri", getSitemapURI(objectModel));
  +    XSPObjectHelper.elementData(URI, PREFIX, handler, "sitemap-uri", getSitemapURI(objectModel));
     }
   
     /**
  @@ -139,9 +137,11 @@
       throws SAXException
     {
       AttributesImpl attr = new AttributesImpl();
  -    addAttribute(attr, "name", name);
  +    XSPObjectHelper.addAttribute(attr, "name", name);
   
  -    elementData(
  +    XSPObjectHelper.elementData(
  +      URI,
  +      PREFIX,
         contentHandler,
         "parameter",
         getParameter(objectModel, name, defaultValue),
  @@ -165,19 +165,19 @@
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
       AttributesImpl attr = new AttributesImpl();
  -    addAttribute(attr, "name", name);
  +    XSPObjectHelper.addAttribute(attr, "name", name);
   
  -    start(contentHandler, "parameter-values", attr);
  +    XSPObjectHelper.start(URI, PREFIX, contentHandler, "parameter-values", attr);
   
       String[] values = request.getParameterValues(name);
   
       if (values != null) {
         for (int i = 0; i < values.length; i++) {
  -        elementData(contentHandler, "value", values[i]);
  +        XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "value", values[i]);
         }
       }
   
  -    end(contentHandler, "parameter-values");
  +    XSPObjectHelper.end(URI, PREFIX, contentHandler, "parameter-values");
     }
   
     /**
  @@ -194,15 +194,15 @@
       throws SAXException
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -    start(contentHandler, "parameter-names");
  +    XSPObjectHelper.start(URI, PREFIX, contentHandler, "parameter-names");
   
       Enumeration e = request.getParameterNames();
       while (e.hasMoreElements()) {
         String name = (String) e.nextElement();
  -      elementData(contentHandler, "name", name);
  +      XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "name", name);
       }
   
  -    end(contentHandler, "parameter-names");
  +    XSPObjectHelper.end(URI, PREFIX, contentHandler, "parameter-names");
     }
   
     /**
  @@ -235,14 +235,16 @@
       throws SAXException
     {
       AttributesImpl attr = new AttributesImpl();
  -    addAttribute(attr, "name", name);
  +    XSPObjectHelper.addAttribute(attr, "name", name);
   
       String value = getHeader(objectModel, name);
       if (value == null) {
         value = "";
       }
   
  -    elementData(
  +    XSPObjectHelper.elementData(
  +      URI,
  +      PREFIX,
         contentHandler,
         "header",
         value,
  @@ -264,15 +266,15 @@
       throws SAXException
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -    start(contentHandler, "header-names");
  +    XSPObjectHelper.start(URI, PREFIX, contentHandler, "header-names");
   
       Enumeration e = request.getHeaderNames();
       while (e.hasMoreElements()) {
         String name = (String) e.nextElement();
  -      elementData(contentHandler, "name", name);
  +      XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "name", name);
       }
   
  -    end(contentHandler, "header-names");
  +    XSPObjectHelper.end(URI, PREFIX, contentHandler, "header-names");
     }
   
     /**
  @@ -397,9 +399,11 @@
       throws SAXException
     {
       AttributesImpl attr = new AttributesImpl();
  -    addAttribute(attr, "name", name);
  +    XSPObjectHelper.addAttribute(attr, "name", name);
   
  -    elementData(
  +    XSPObjectHelper.elementData(
  +      URI,
  +      PREFIX,
         contentHandler,
         "attribute",
         (String) getSessionAttribute(objectModel, name, defaultValue),
  @@ -438,7 +442,7 @@
       throws SAXException
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -    elementData(contentHandler, "remote-user", request.getRemoteUser());
  +    XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "remote-user", request.getRemoteUser());
     }
   
   
  @@ -469,7 +473,7 @@
       throws SAXException
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -    elementData(contentHandler, "method", request.getMethod());
  +    XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "method", request.getMethod());
     }
   
       /**
  @@ -501,7 +505,7 @@
       throws SAXException
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -    elementData(contentHandler, "query-string", request.getQueryString());
  +    XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "query-string", request.getQueryString());
     }
   
       /**
  @@ -533,7 +537,7 @@
         throws SAXException
       {
         Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -      elementData(contentHandler, "protocol", request.getProtocol());
  +      XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "protocol", request.getProtocol());
       }
   
       /**
  @@ -567,7 +571,7 @@
       throws SAXException
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -    elementData(contentHandler, "remote-user", request.getRemoteHost());
  +    XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "remote-user", request.getRemoteHost());
     }
   
       /**
  @@ -597,7 +601,7 @@
       throws SAXException
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -    elementData(contentHandler, "remote-address", request.getRemoteAddr());
  +    XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "remote-address", request.getRemoteAddr());
     }
   
   
  @@ -805,6 +809,6 @@
       throws SAXException
     {
       Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
  -    elementData(contentHandler, "context-path", request.getContextPath());
  +    XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "context-path", request.getContextPath());
     }
   }
  
  
  
  1.1.1.1.2.1 +4 -7      xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPResponseHelper.java
  
  Index: XSPResponseHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPResponseHelper.java,v
  retrieving revision 1.1.1.1
  retrieving revision 1.1.1.1.2.1
  diff -u -r1.1.1.1 -r1.1.1.1.2.1
  --- XSPResponseHelper.java	2001/05/09 20:49:53	1.1.1.1
  +++ XSPResponseHelper.java	2001/06/14 15:11:35	1.1.1.1.2.1
  @@ -12,7 +12,6 @@
   import java.util.Map;
   import org.apache.cocoon.Constants;
   import org.apache.cocoon.environment.Response;
  -import org.apache.log.LogKit;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   import org.xml.sax.helpers.AttributesImpl;
  @@ -21,16 +20,14 @@
    * The XSP <code>Response</code> object helper
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.1.1 $ $Date: 2001/05/09 20:49:53 $
  + * @version CVS $Revision: 1.1.1.1.2.1 $ $Date: 2001/06/14 15:11:35 $
    */
  -public class XSPResponseHelper extends XSPObjectHelper {
  +public class XSPResponseHelper {
     /**
      * Assign values to the object's namespace uri and prefix
      */
  -  static {
  -    URI = Constants.XSP_RESPONSE_URI;
  -    PREFIX = Constants.XSP_RESPONSE_PREFIX;
  -  }
  +  private static final String URI = Constants.XSP_RESPONSE_URI;
  +  private static final String PREFIX = Constants.XSP_RESPONSE_PREFIX;
   
     /**
      * Set the content header for a given response
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message