1 12 package org.eclipse.equinox.http.servlet.internal; 13 14 import java.util.*; 15 import javax.servlet.*; 16 17 public class ServletConfigImpl implements ServletConfig { 18 19 private static final Dictionary EMPTY_PARAMS = new Hashtable(0); 20 private static final String SERVLET_NAME = "servlet-name"; private Servlet servlet; 22 private Dictionary initparams; 23 private ServletContext servletContext; 24 25 public ServletConfigImpl(Servlet servlet, Dictionary initparams, ServletContext servletContext) { 26 this.servlet = servlet; 27 this.initparams = (initparams != null) ? initparams : EMPTY_PARAMS; 28 this.servletContext = servletContext; 29 } 30 31 37 public String getServletName() { 38 String servletName = (String ) initparams.get(SERVLET_NAME); 39 return (servletName != null) ? servletName : servlet.getClass().getName(); 40 } 41 42 public ServletContext getServletContext() { 43 return servletContext; 44 } 45 46 public String getInitParameter(String name) { 47 return (String ) initparams.get(name); 48 } 49 50 public Enumeration getInitParameterNames() { 51 return initparams.keys(); 52 } 53 } 54 | Popular Tags |