From 1275d3d979b62705e2d8ee0761aa4e16af2b876f Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 11 Oct 2003 00:13:17 +0000 Subject: [PATCH] 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 --- .../velocity/InvocationContext.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/velocity/InvocationContext.java b/projects/samskivert/src/java/com/samskivert/velocity/InvocationContext.java index 3ed43e34..07112849 100644 --- a/projects/samskivert/src/java/com/samskivert/velocity/InvocationContext.java +++ b/projects/samskivert/src/java/com/samskivert/velocity/InvocationContext.java @@ -1,9 +1,9 @@ // -// $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 // Copyright (C) 2001 Michael Bayne -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -20,6 +20,8 @@ package com.samskivert.velocity; +import java.util.Enumeration; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -88,6 +90,19 @@ public class InvocationContext extends VelocityContext 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 HttpServletResponse _rsp; }