01: /*
02: * Copyright 2005 jWic group (http://www.jwic.de)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: *
16: * de.jwic.util.Compatibility
17: * Created on 08.06.2006
18: * $Id: Compatibility.java,v 1.1 2006/06/13 11:55:49 lordsam Exp $
19: */
20: package de.jwic.util;
21:
22: import java.util.Collections;
23: import java.util.Enumeration;
24: import java.util.HashMap;
25: import java.util.Map;
26:
27: import javax.servlet.http.HttpServletRequest;
28:
29: /**
30: * Contains methods to handle compatibility issues between the differnet
31: * JDKs and ServletAPIs that may be used for jWic.
32: *
33: * @author Florian Lippisch
34: * @version $Revision: 1.1 $
35: */
36: public class Compatibility {
37:
38: /**
39: * request.getParameterMap() is not supported by older ServletAPIs.
40: * the map must be created the old (compatible) way.
41: */
42: public static Map getParameterMap(HttpServletRequest request) {
43: Map parameter = new HashMap();
44: for (Enumeration e = request.getParameterNames(); e
45: .hasMoreElements();) {
46: String key = (String) e.nextElement();
47: parameter.put(key, request.getParameterValues(key));
48: }
49: return Collections.unmodifiableMap(parameter);
50: }
51:
52: }
|