Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.servlet
Class GenericServlet

    java.lang.Object
      |
      +--javax.servlet.GenericServlet

Direct Known Subclasses:
  HttpServlet, Page, com.caucho.jsp.QServlet, XslFilter

public abstract class GenericServlet
extends java.lang.Object
implements Servlet, ServletConfig, java.io.Serializable

GenericServlet is a convenient abstract class for defining Servlets. Servlets which need more control than HttpServlet can extend GenericServlet.

In addition, GenericServlet implements ServletConfig to make it easier to get configuration information.

See Also:
  Serialized Form

Constructor Summary
`GenericServlet()`

Method Summary
`void` | `destroy()` Called when the servlet (and the application) shuts down.
`java.lang.String` | `getInitParameter(java.lang.String name)` Returns an initialization parameter.
`java.util.Enumeration` | `getInitParameterNames()` Enumerates all the initialization parameter.
`ServletConfig` | `getServletConfig()` Returns this servlet's configuration.
`ServletContext` | `getServletContext()` Returns the application (servlet context) that the servlet belongs to.
`java.lang.String` | `getServletInfo()` Returns a string describing the servlet.
`java.lang.String` | `getServletName()` Returns the servlet name for this configuration.
`void` | `init()` Initialize the servlet.
`void` | `init(ServletConfig config)` Initialize the servlet.
`void` | `log(java.lang.String message)` Logs an error message in the application's log.
`void` | `log(java.lang.String message, java.lang.Throwable cause)` Logs an error message and an exception trace in the application's log.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GenericServlet

    public GenericServlet()

Method Detail

### init

    public void init(ServletConfig config)
              throws ServletException

  Initialize the servlet. Most servlets should override the null parameter `init()` instead.
  Specified by:
    init in interface Servlet
  Parameters:
    `config` - the servlet's configuration

### init

    public void init()
              throws ServletException

  Initialize the servlet. Servlets should override this method if they need any initialization like opening pooled database connections.

### getServletConfig

    public ServletConfig getServletConfig()

  Returns this servlet's configuration.
  Specified by:
    getServletConfig in interface Servlet

### getServletName

    public java.lang.String getServletName()

  Returns the servlet name for this configuration. For example, 'myservlet' in the following configuration:

       <servlet servlet-name='myservlet'
                servlet-class='test.MyServlet'/>

  Specified by:
    getServletName in interface ServletConfig

### getInitParameter

    public java.lang.String getInitParameter(java.lang.String name)

  Returns an initialization parameter. Initialization parameters are defined in the servlet configuration (in resin.conf) as follows:

       <servlet servlet-name='myservlet'
                servlet-class='test.MyServlet'>
         <init-param param1='value1'/>
         <init-param param2='value2'/>
       </servlet>

  Specified by:
    getInitParameter in interface ServletConfig
  Parameters:
    `name` - of the parameter
  Returns:
    the init parameter value

### getInitParameterNames

    public java.util.Enumeration getInitParameterNames()

  Enumerates all the initialization parameter.
  Specified by:
    getInitParameterNames in interface ServletConfig

### getServletContext

    public ServletContext getServletContext()

  Returns the application (servlet context) that the servlet belongs to. The application provides several useful methods, e.g. including other files, forwarding, and translating physical paths.
  Specified by:
    getServletContext in interface ServletConfig

### getServletInfo

    public java.lang.String getServletInfo()

  Returns a string describing the servlet.
  Specified by:
    getServletInfo in interface Servlet

### log

    public void log(java.lang.String message)

  Logs an error message in the application's log.

### log

    public void log(java.lang.String message,
                    java.lang.Throwable cause)

  Logs an error message and an exception trace in the application's log.

### destroy

    public void destroy()

  Called when the servlet (and the application) shuts down.
  Specified by:
    destroy in interface Servlet

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD