something like this: (omitting imports, decent error handling, etc)

public class MyFilter implements Filter {
public void doFilter(ServletRequest request,
                            ServletResponse response,
                            FilterChain chain)  {
   HttpServletRequest hrequest = (HttpServletRequest) request;
   // make a mutable copy of its parameters
   final HashMap myMap = new HashMap(hrequest.getParameterMap());
   // put in the extra value, as a string array
   myMap.put("foo", new String[] {"bar"});
   hrequest = new HttpServletRequestWrapper(hrequest) {
        // now override the parameter methods to use mymap
        public Map getParameterMap() { return myMap; }
        public String getParameter(String name) {
            String[] value = getParameterValues(name);
            return value == null || values.length() == 0 ? null : values[0];
        }
        public String getParameterValues(String name) {
            return (String[]) myMap.get(name);
        }
        public Enumeration getParameterNames() {
            return Collections.enumeration(myMap.keySet());
        }
   };
   chain.doFilter(hrequest, response);
}
//... etc
}

On 4/25/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi Ray,
> Can you give me an example (piece of code) how to actually add parameters to 
> the servlet request? I can't see how it could be done.
>
> Regards
> Gunnar
>
> Ray Krueger Wrote:
> > You can write your own servlet filter that picks up the CGIServlet
> >requests and adds whatever parameters you need to the request. Just
> >make sure it's chained after the Acegi security filters.
>
>
>
>
>
>
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642
> _______________________________________________
> Home: http://acegisecurity.org
> Acegisecurity-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
>


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to