1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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  }