cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/modules/input HeaderAttributeModule.java RequestAttributeModule.java RequestParameterModule.java SessionAttributeModule.java
Date Wed, 23 Apr 2003 13:37:36 GMT
haul        2003/04/23 06:37:36

  Modified:    src/java/org/apache/cocoon/components/modules/input
                        HeaderAttributeModule.java
                        RequestAttributeModule.java
                        RequestParameterModule.java
                        SessionAttributeModule.java
  Log:
  In case an attribute name contained a wildcard "*" all matching attributes
  are combined into one, but order was random.
  Now, all matching names are ordered alphabetically and values are combined
  in this order.
  
  Revision  Changes    Path
  1.2       +16 -7     cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/HeaderAttributeModule.java
  
  Index: HeaderAttributeModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/HeaderAttributeModule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HeaderAttributeModule.java	9 Mar 2003 00:09:03 -0000	1.1
  +++ HeaderAttributeModule.java	23 Apr 2003 13:37:35 -0000	1.2
  @@ -62,6 +62,8 @@
   import java.util.LinkedList;
   import java.util.List;
   import java.util.Map;
  +import java.util.SortedSet;
  +import java.util.TreeSet;
   
   /**
    * HeaderAttributeModule accesses request header attributes. If the
  @@ -120,14 +122,21 @@
               } else {
                   suffix = "";
               }
  -            List values = new LinkedList();
  -            Enumeration names = request.getHeaderNames();
  -            
  -            while (names.hasMoreElements()) {
  -                String pname = (String) names.nextElement();
  +            SortedSet names = new TreeSet();
  +            Enumeration allNames = request.getHeaderNames();
  +
  +            while (allNames.hasMoreElements()) {
  +                String pname = (String) allNames.nextElement();
                   if ( pname.startsWith( prefix ) && pname.endsWith( suffix ) ) {
  -                    values.add( request.getHeader( pname ) );
  +                    names.add(pname);
                   }
  +            }
  +
  +            List values = new LinkedList();
  +            Iterator j = names.iterator();
  +            while (j.hasNext()){
  +                String pname = (String) j.next();
  +                values.add( request.getHeader( pname ) );
               }
               
               return values.toArray();
  
  
  
  1.2       +18 -9     cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/RequestAttributeModule.java
  
  Index: RequestAttributeModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/RequestAttributeModule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestAttributeModule.java	9 Mar 2003 00:09:03 -0000	1.1
  +++ RequestAttributeModule.java	23 Apr 2003 13:37:35 -0000	1.2
  @@ -62,6 +62,8 @@
   import java.util.LinkedList;
   import java.util.List;
   import java.util.Map;
  +import java.util.SortedSet;
  +import java.util.TreeSet;
   
   /**
    * RequestAttributeModule accesses request attributes. If the
  @@ -121,15 +123,22 @@
               } else {
                   suffix = "";
               }
  -            List values = new LinkedList();
  -            Enumeration names = request.getAttributeNames();
  +            SortedSet names = new TreeSet();
  +            Enumeration allNames = request.getAttributeNames();
   
  -            while (names.hasMoreElements()) {
  -                String pname = (String) names.nextElement();
  -                if ( pname.startsWith( prefix ) && pname.endsWith( suffix ) ) {
  -                    values.add( request.getAttribute( pname ) );
  -                }
  -            }
  +           while (allNames.hasMoreElements()) {
  +               String pname = (String) allNames.nextElement();
  +               if ( pname.startsWith( prefix ) && pname.endsWith( suffix ) ) {
  +                   names.add(pname);
  +               }
  +           }
  +
  +           List values = new LinkedList();
  +           Iterator j = names.iterator();
  +           while (j.hasNext()){
  +               String pname = (String) j.next();
  +               values.add( request.getAttribute( pname ) );
  +           }
   
               return values.toArray();
   
  
  
  
  1.2       +15 -6     cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/RequestParameterModule.java
  
  Index: RequestParameterModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/RequestParameterModule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestParameterModule.java	9 Mar 2003 00:09:03 -0000	1.1
  +++ RequestParameterModule.java	23 Apr 2003 13:37:35 -0000	1.2
  @@ -62,6 +62,8 @@
   import java.util.LinkedList;
   import java.util.List;
   import java.util.Map;
  +import java.util.SortedSet;
  +import java.util.TreeSet;
   
   /**
    * RequestParameterModule accesses request parameters. If the
  @@ -121,14 +123,21 @@
               } else {
                   suffix = "";
               }
  -            List values = new LinkedList();
  -            Enumeration names = request.getParameterNames();
  +            SortedSet names = new TreeSet();
  +            Enumeration allNames = request.getParameterNames();
   
  -            while (names.hasMoreElements()) {
  -                String pname = (String) names.nextElement();
  +            while (allNames.hasMoreElements()) {
  +                String pname = (String) allNames.nextElement();
                   if ( pname.startsWith( prefix ) && pname.endsWith( suffix ) ) {
  -                    values.add( request.getParameter( pname ) );
  +                    names.add(pname);
                   }
  +            }
  +
  +            List values = new LinkedList();
  +            Iterator j = names.iterator();
  +            while (j.hasNext()){
  +                String pname = (String) j.next();
  +                values.add( request.getParameter( pname ) );
               }
   
               return values.toArray();
  
  
  
  1.2       +17 -6     cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/SessionAttributeModule.java
  
  Index: SessionAttributeModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/SessionAttributeModule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SessionAttributeModule.java	9 Mar 2003 00:09:03 -0000	1.1
  +++ SessionAttributeModule.java	23 Apr 2003 13:37:35 -0000	1.2
  @@ -56,12 +56,15 @@
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
  +import org.apache.cocoon.environment.Session;
   
   import java.util.Enumeration;
   import java.util.Iterator;
   import java.util.LinkedList;
   import java.util.List;
   import java.util.Map;
  +import java.util.SortedSet;
  +import java.util.TreeSet;
   
   /**
    * SessionAttributeModule accesses session attributes. If the
  @@ -121,14 +124,22 @@
               } else {
                   suffix = "";
               }
  -            List values = new LinkedList();
  -            Enumeration names = request.getSession().getAttributeNames();
  +            SortedSet names = new TreeSet();
  +            Session session = request.getSession();
  +            Enumeration allNames = session.getAttributeNames();
   
  -            while (names.hasMoreElements()) {
  -                String pname = (String) names.nextElement();
  +            while (allNames.hasMoreElements()) {
  +                String pname = (String) allNames.nextElement();
                   if ( pname.startsWith( prefix ) && pname.endsWith( suffix ) ) {
  -                    values.add( request.getSession().getAttribute( pname ) );
  +                    names.add(pname);
                   }
  +            }
  +
  +            List values = new LinkedList();
  +            Iterator j = names.iterator();
  +            while (j.hasNext()){
  +                String pname = (String) j.next();
  +                values.add( session.getAttribute(pname) );
               }
   
               return values.toArray();
  
  
  

Mime
View raw message