01: package com.ecyrd.jspwiki.plugin;
02:
03: import java.util.*;
04: import javax.servlet.*;
05: import javax.servlet.http.*;
06:
07: /**
08: * A request object with a new param set (all other params hidden)
09: */
10: public class LocalParamHttpServletRequestWrapper extends
11: HttpServletRequestWrapper {
12:
13: public LocalParamHttpServletRequestWrapper(
14: HttpServletRequest request) {
15: super (request);
16: m = new HashMap();
17: }
18:
19: public void setQueryString(String s) {
20: qs = s;
21: }
22:
23: public String getQueryString() {
24: return qs;
25: }
26:
27: public void setParameterMap(Map m) {
28: this .m = m;
29: }
30:
31: public void setParameterValue(String key, String val) {
32: m.put(key, new String[] { val });
33: }
34:
35: public void setParameterValues(String key, String[] val) {
36: m.put(key, val);
37: }
38:
39: public Map getParameterMap() {
40: return m;
41: }
42:
43: public Enumeration getParameterNames() {
44: return Collections.enumeration(m.keySet());
45: }
46:
47: public String[] getParameterValues(String key) {
48: return (String[]) m.get(key);
49: }
50:
51: public String getParameter(String key) {
52: String res = null;
53: String[] v = (String[]) getParameterValues(key);
54: if (v != null)
55: res = v[0];
56: return res;
57: }
58:
59: private Map m;
60: private String qs;
61:
62: }
|