Add handy function to slide all the request params into the context.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1259 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
eric
2003-10-11 00:13:17 +00:00
parent b524bf58ed
commit 1275d3d979
@@ -1,5 +1,5 @@
// //
// $Id: InvocationContext.java,v 1.2 2003/06/28 17:11:54 mdb Exp $ // $Id: InvocationContext.java,v 1.3 2003/10/11 00:13:17 eric Exp $
// //
// samskivert library - useful routines for java programs // samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne // Copyright (C) 2001 Michael Bayne
@@ -20,6 +20,8 @@
package com.samskivert.velocity; package com.samskivert.velocity;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -88,6 +90,19 @@ public class InvocationContext extends VelocityContext
put(key, new Boolean(value)); put(key, new Boolean(value));
} }
/**
* Puts all the parameters in the request into the context.
*/
public void putAllParameters ()
{
Enumeration e = _req.getParameterNames();
while (e.hasMoreElements()) {
String param = (String)e.nextElement();
put(param, _req.getParameter(param));
}
}
protected HttpServletRequest _req; protected HttpServletRequest _req;
protected HttpServletResponse _rsp; protected HttpServletResponse _rsp;
} }