Class EncapsulatingServlet

All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public abstract class EncapsulatingServlet extends HttpServlet
Servlet implemented by encapsulating an instance of ServletAdapter. Subclasses are expected to provide a constructor with no arguments that creates an instance of ServletAdapter and passes it to the constructor of this class. For example,

  public class OurServlet extends EncapsulatingServlet {
     public OurServlet() {
       super(new OurAdapter());
     }
  }
 

To use this class, A JAR file containing the servlet API must be on the classpath or accessible via the module path. For releases whose manifest does not contain an AUTOMATIC-MODULE-NAME declaration, the file name must be servlet-api.jar. This of course is subject to change.

ServletAdapter states are handled internally by setting and getting a session attribute named "state", so the attribute name "state" should be treated a reserved name. Servlet adapters use a subset of the servlet API. If more of the API is needed (e.g., for logins), methods such as doPost(HttpServletRequest,HttpServletResponse) should be overridden to add additional functionality.

See Also: