01: /*
02: * Copyright 2003-2006 Rick Knowles <winstone-devel at lists sourceforge net>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: */
07: package javax.servlet;
08:
09: import java.io.IOException;
10: import java.io.Serializable;
11: import java.util.Enumeration;
12:
13: /**
14: * The base class from which all servlets extend.
15: *
16: * @author <a href="mailto:rick_knowles@hotmail.com">Rick Knowles</a>
17: */
18: public abstract class GenericServlet implements Servlet, ServletConfig,
19: Serializable {
20: private ServletConfig config;
21:
22: public GenericServlet() {
23: }
24:
25: public String getInitParameter(String name) {
26: return config.getInitParameter(name);
27: }
28:
29: public Enumeration getInitParameterNames() {
30: return config.getInitParameterNames();
31: }
32:
33: public ServletConfig getServletConfig() {
34: return this .config;
35: }
36:
37: public void init(ServletConfig config) throws ServletException {
38: this .config = config;
39: init();
40: }
41:
42: public void init() throws ServletException {
43: }
44:
45: public void destroy() {
46: }
47:
48: public ServletContext getServletContext() {
49: return config.getServletContext();
50: }
51:
52: public String getServletInfo() {
53: return "";
54: }
55:
56: public String getServletName() {
57: return config.getServletName();
58: }
59:
60: public void log(String msg) {
61: config.getServletContext().log(msg);
62: }
63:
64: public void log(String message, Throwable t) {
65: config.getServletContext().log(message, t);
66: }
67:
68: public abstract void service(ServletRequest req, ServletResponse res)
69: throws IOException, ServletException;
70: }
|