Defines a generic, protocol-independent servlet. To write an HTTP servlet for use on the Web, extend jakarta.servlet.http.HttpServlet instead. GenericServlet implements the Servlet and ServletConfig interfaces. GenericServlet may be dir
| 36 | * To write a generic servlet, you need only override the abstract <code>service</code> method. |
| 37 | */ |
| 38 | public abstract class GenericServlet implements Servlet, ServletConfig, java.io.Serializable { |
| 39 | |
| 40 | @Serial |
| 41 | private static final long serialVersionUID = 1L; |
| 42 | |
| 43 | private transient ServletConfig config; |
| 44 | |
| 45 | /** |
| 46 | * Does nothing. All of the servlet initialization is done by one of the <code>init</code> methods. |
| 47 | */ |
| 48 | public GenericServlet() { |
| 49 | // NOOP |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. See |
| 54 | * {@link Servlet#destroy}. |
| 55 | */ |
| 56 | @Override |
| 57 | public void destroy() { |
| 58 | // NOOP by default |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Returns a <code>String</code> containing the value of the named initialization parameter, or <code>null</code> if |
| 63 | * the parameter does not exist. See {@link ServletConfig#getInitParameter}. |
| 64 | * <p> |
| 65 | * This method is supplied for convenience. It gets the value of the named parameter from the servlet's |
| 66 | * <code>ServletConfig</code> object. |
| 67 | * |
| 68 | * @param name a <code>String</code> specifying the name of the initialization parameter |
| 69 | * |
| 70 | * @return String a <code>String</code> containing the value of the initialization parameter |
| 71 | */ |
| 72 | @Override |
| 73 | public String getInitParameter(String name) { |
| 74 | return getServletConfig().getInitParameter(name); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns the names of the servlet's initialization parameters as an <code>Enumeration</code> of |
| 79 | * <code>String</code> objects, or an empty <code>Enumeration</code> if the servlet has no initialization |
| 80 | * parameters. See {@link ServletConfig#getInitParameterNames}. |
| 81 | * <p> |
| 82 | * This method is supplied for convenience. It gets the parameter names from the servlet's |
| 83 | * <code>ServletConfig</code> object. |
| 84 | * |
| 85 | * @return Enumeration an enumeration of <code>String</code> objects containing the names of the servlet's |
| 86 | * initialization parameters |
| 87 | */ |
| 88 | @Override |
| 89 | public Enumeration<String> getInitParameterNames() { |
| 90 | return getServletConfig().getInitParameterNames(); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Returns this servlet's {@link ServletConfig} object. |
| 95 | * |
nothing calls this directly
no outgoing calls
no test coverage detected