Java Servlet Programming, 2nd Edition > A. Servlet API Quick Reference > Servlet |
SynopsisInterface Name: javax.servlet.Servlet Superinterface: None Immediate Subinterfaces: None Implemented By: javax.servlet.GenericServlet Availability: Servlet API 1.0 and later DescriptionAll servlets implement the Servlet interface, either directly or by subclassing the GenericServlet or HttpServlet class. Most servlet developers find it easier to subclass one of the two existing servlet classes than to implement this interface directly. The interface declares the basic servlet functionality initializing a servlet, handling a client request, and destroying a servlet. Interface Declarationpublic interface Servlet { // Methods public abstract void destroy(); public abstract ServletConfig getServletConfig(); public abstract String getServletInfo(); public abstract void init(ServletConfig config) throws ServletException; public abstract void service(ServletRequest req, ServletResponse res) throws ServletException, IOException; } Methodsdestroy()public abstract void destroy()
getServletConfig()public abstract ServletConfig getServletConfig()
getServletInfo()public abstract String getServletInfo()
init()public abstract void init(ServletConfig config) throws ServletException
service()public abstract void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
|