1 16 package org.directwebremoting.util; 17 18 import java.util.Collections ; 19 import java.util.Enumeration ; 20 import java.util.HashMap ; 21 import java.util.Map ; 22 23 import javax.servlet.ServletConfig ; 24 import javax.servlet.ServletContext ; 25 26 31 public class FakeServletConfig implements ServletConfig 32 { 33 37 public FakeServletConfig(String name, ServletContext servletContext) 38 { 39 this(name, servletContext, null); 40 } 41 42 47 public FakeServletConfig(String name, ServletContext servletContext, Map initParameters) 48 { 49 this.name = name; 50 this.servletContext = servletContext; 51 this.initParameters = initParameters; 52 53 if (this.initParameters == null) 54 { 55 this.initParameters = new HashMap (); 56 } 57 } 58 59 62 public String getServletName() 63 { 64 return name; 65 } 66 67 70 public ServletContext getServletContext() 71 { 72 return servletContext; 73 } 74 75 78 public String getInitParameter(String paramName) 79 { 80 Object obj = initParameters.get(paramName); 81 if (obj instanceof String ) 82 { 83 return (String ) obj; 84 } 85 else 86 { 87 return null; 88 } 89 } 90 91 94 public Enumeration getInitParameterNames() 95 { 96 return Collections.enumeration(initParameters.keySet()); 97 } 98 99 102 private final String name; 103 104 107 private ServletContext servletContext; 108 109 112 private Map initParameters; 113 } 114 | Popular Tags |