| DynamicServletConfig.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.util.servlet;
16
17 import java.util.Collections;
18 import java.util.Enumeration;
19 import java.util.Map;
20
21 import javax.servlet.ServletConfig;
22 import javax.servlet.ServletContext;
23
24 /**
25 * <a href="DynamicServletConfig.java.html"><b><i>View Source</i></b></a>
26 *
27 * @author Brian Wing Shun Chan
28 */
29 public class DynamicServletConfig implements ServletConfig {
30
31 public DynamicServletConfig(
32 ServletConfig servletConfig, Map<String, String> params) {
33
34 _servletConfig = servletConfig;
35 _params = params;
36 }
37
38 public String getInitParameter(String name) {
39 return _params.get(name);
40 }
41
42 public Enumeration<String> getInitParameterNames() {
43 return Collections.enumeration(_params.keySet());
44 }
45
46 public ServletContext getServletContext() {
47 return _servletConfig.getServletContext();
48 }
49
50 public String getServletName() {
51 return _servletConfig.getServletName();
52 }
53
54 private ServletConfig _servletConfig;
55 private Map<String, String> _params;
56
57 }