Class HttpServletBean

All Implemented Interfaces:
Servlet, ServletConfig, Serializable, Aware, EnvironmentAware, EnvironmentCapable
Direct Known Subclasses:

public abstract class HttpServletBean extends HttpServlet implements EnvironmentCapable, EnvironmentAware
Simple extension of HttpServlet which treats its config parameters (init-param entries within the servlet tag in web.xml) as bean properties.

A handy superclass for any type of servlet. Type conversion of config parameters is automatic, with the corresponding setter method getting invoked with the converted value. It is also possible for subclasses to specify required properties. Parameters without matching bean property setter will simply be ignored.

This servlet leaves request handling to subclasses, inheriting the default behavior of HttpServlet (doGet, doPost, etc).

This generic servlet base class has no dependency on the Spring ApplicationContext concept. Simple servlets usually don't load their own context but rather access service beans from the Spring root application context, accessible via the filter's ServletContext (see WebApplicationContextUtils).

The FrameworkServlet class is a more specific servlet base class which loads its own application context. FrameworkServlet serves as direct base class of Spring's full-fledged DispatcherServlet.

Rod Johnson, Juergen Hoeller
See Also:
  • Field Details

    • logger

      protected final Log logger
      Logger available to subclasses.
  • Constructor Details

    • HttpServletBean

      public HttpServletBean()
  • Method Details