1 17 package javax.servlet; 18 19 import java.io.IOException ; 20 import java.util.Enumeration ; 21 22 50 51 52 public abstract class GenericServlet 53 implements Servlet , ServletConfig , java.io.Serializable 54 { 55 56 private transient ServletConfig config; 57 58 59 65 66 public GenericServlet() { } 67 68 69 70 76 77 public void destroy() { 78 } 79 80 81 82 98 99 public String getInitParameter(String name) { 100 return getServletConfig().getInitParameter(name); 101 } 102 103 104 105 121 122 public Enumeration getInitParameterNames() { 123 return getServletConfig().getInitParameterNames(); 124 } 125 126 127 128 129 130 137 138 public ServletConfig getServletConfig() { 139 return config; 140 } 141 142 143 144 145 158 159 public ServletContext getServletContext() { 160 return getServletConfig().getServletContext(); 161 } 162 163 164 165 166 167 179 180 public String getServletInfo() { 181 return ""; 182 } 183 184 185 186 187 209 210 public void init(ServletConfig config) throws ServletException { 211 this.config = config; 212 this.init(); 213 } 214 215 216 217 218 219 235 236 public void init() throws ServletException { 237 238 } 239 240 241 242 243 252 253 public void log(String msg) { 254 getServletContext().log(getServletName() + ": "+ msg); 255 } 256 257 258 259 260 275 276 public void log(String message, Throwable t) { 277 getServletContext().log(getServletName() + ": " + message, t); 278 } 279 280 281 282 305 306 public abstract void service(ServletRequest req, ServletResponse res) 307 throws ServletException , IOException ; 308 309 310 311 320 321 public String getServletName() { 322 return config.getServletName(); 323 } 324 } 325 | Popular Tags |