org.springframework.web.servlet
Class HttpServletBean

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.springframework.web.servlet.HttpServletBean
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
FrameworkServlet, ResourceServlet

public abstract class HttpServletBean
extends javax.servlet.http.HttpServlet

Simple extension of javax.servlet.http.HttpServlet that treats its config parameters as bean properties. A very handy superclass for any type of servlet. Type conversion is automatic. It is also possible for subclasses to specify required properties.

This servlet leaves request handling to subclasses, inheriting the default behaviour of HttpServlet.

This servlet superclass has no dependency on a Spring application context.

Author:
Rod Johnson
See Also:
initServletBean(), Serialized Form

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
HttpServletBean()
           
 
Method Summary
 void init()
          Map config parameters onto bean properties of this servlet, and invoke subclass initialization.
protected  void initServletBean()
          Subclasses may override this to perform custom initialization.
protected  void setRequiredProperty(java.lang.String property)
          Subclasses can invoke this method to specify that this property (which must match a JavaBean property they expose) is mandatory, and must be supplied as a config parameter.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

HttpServletBean

public HttpServletBean()
Method Detail

setRequiredProperty

protected final void setRequiredProperty(java.lang.String property)
Subclasses can invoke this method to specify that this property (which must match a JavaBean property they expose) is mandatory, and must be supplied as a config parameter.

Parameters:
property - name of the required property

init

public final void init()
                throws javax.servlet.ServletException
Map config parameters onto bean properties of this servlet, and invoke subclass initialization.

Throws:
javax.servlet.ServletException - if bean properties are invalid (or required properties are missing), or if subclass initialization fails.

initServletBean

protected void initServletBean()
                        throws javax.servlet.ServletException
Subclasses may override this to perform custom initialization. All bean properties of this servlet will have been set before this method is invoked. This default implementation does nothing.

Throws:
javax.servlet.ServletException - if subclass initialization fails


Copyright (C) 2003-2004 The Spring Framework Project.