1 package servletunit; 2 3 19 import javax.servlet.ServletConfig ; 20 import javax.servlet.ServletContext ; 21 import java.util.Enumeration ; 22 import java.util.Hashtable ; 23 24 27 28 public class ServletConfigSimulator implements ServletConfig 29 { 30 31 private Hashtable parameters; 32 private ServletContext context; 33 34 public ServletConfigSimulator() 35 { 36 parameters=new Hashtable (); 37 context = new ServletContextSimulator(); 38 } 39 40 52 public String getInitParameter(String name) 53 { 54 return (String ) parameters.get(name); 55 } 56 57 70 public Enumeration getInitParameterNames() 71 { 72 return parameters.keys(); 73 } 74 75 87 public ServletContext getServletContext() 88 { 89 return context; 90 } 91 92 103 public String getServletName() 104 { 105 return "ActionServlet"; 106 } 107 108 119 public void setInitParameter(String key,String value) 120 { 121 parameters.put(key,value); 122 } 123 124 } 125 126 | Popular Tags |