cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/util NetUtils.java
Date Mon, 15 Apr 2002 06:48:50 GMT
cziegeler    02/04/14 23:48:50

  Modified:    src/java/org/apache/cocoon/util NetUtils.java
  Log:
  Adding new helper method
  
  Revision  Changes    Path
  1.7       +27 -1     xml-cocoon2/src/java/org/apache/cocoon/util/NetUtils.java
  
  Index: NetUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/util/NetUtils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NetUtils.java	28 Feb 2002 14:19:12 -0000	1.6
  +++ NetUtils.java	15 Apr 2002 06:48:50 -0000	1.7
  @@ -55,15 +55,19 @@
   import java.io.OutputStreamWriter;
   
   import java.util.BitSet;
  +import java.util.Enumeration;
   import java.util.Iterator;
   import java.util.Map;
   
  +import org.apache.avalon.excalibur.source.SourceParameters;
  +import org.apache.cocoon.environment.Request;
  +
   /**
    * A collection of <code>File</code>, <code>URL</code> and filename
    * utility methods
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Id: NetUtils.java,v 1.6 2002/02/28 14:19:12 vgritsenko Exp $
  + * @version CVS $Id: NetUtils.java,v 1.7 2002/04/15 06:48:50 cziegeler Exp $
    */
   
   public class NetUtils {
  @@ -385,4 +389,26 @@
           }
           return buffer.toString();
       }
  +
  +    /**
  +     * Create new <code>SourceParameters</code> with the same
  +     * parameters as the current request
  +     */
  +    public static SourceParameters createParameters(Request request) {
  +        final SourceParameters pars = new SourceParameters();
  +        if ( null != request ) {
  +            final Enumeration names = request.getParameterNames();
  +            while ( names.hasMoreElements() ) {
  +                final String current = (String)names.nextElement();
  +                final String[] values = request.getParameterValues( current );
  +                if ( null != values ) {
  +                    for(int i=0; i < values.length; i++) {
  +                        pars.setParameter( current, values[i]);
  +                    }
  +                }
  +            }
  +        }
  +        return pars;
  +    }
  +
   }
  
  
  

----------------------------------------------------------------------
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