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:[EMAIL PROTECTED]">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: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]