1 10 11 package mondrian.tui; 12 13 import java.util.Map ; 14 import java.util.HashMap ; 15 import java.util.Enumeration ; 16 import java.util.Collections ; 17 import javax.servlet.ServletConfig ; 18 import javax.servlet.ServletContext ; 19 20 31 public class MockServletConfig implements ServletConfig { 32 private String servletName; 33 private Map <String , String > initParams; 34 private ServletContext servletContext; 35 36 public MockServletConfig() { 37 this(null); 38 } 39 public MockServletConfig(ServletContext servletContext) { 40 this.initParams = new HashMap <String , String >(); 41 this.servletContext = servletContext; 42 } 43 44 48 public String getServletName() { 49 return servletName; 50 } 51 52 57 public ServletContext getServletContext() { 58 return servletContext; 59 } 60 61 66 public String getInitParameter(String key) { 67 return initParams.get(key); 68 } 69 70 76 public Enumeration getInitParameterNames() { 77 return Collections.enumeration(initParams.keySet()); 78 } 79 80 public void setServletName(String servletName) { 86 this.servletName = servletName; 87 } 88 public void addInitParameter(String key, String value) { 89 if (value != null) { 90 this.initParams.put(key, value); 91 } 92 } 93 public void setServletContext(ServletContext servletContext) { 94 this.servletContext = servletContext; 95 } 96 } 97 | Popular Tags |