org.spicefactory.cinnamon.web
Class AbstractCinnamonServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.spicefactory.cinnamon.web.AbstractCinnamonServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig
Direct Known Subclasses:
CinnamonServlet, SpringCinnamonServlet, XmlCinnamonServlet

public abstract class AbstractCinnamonServlet
extends HttpServlet

The abstract base Servlet for processing HTTP based AMF3 requests.

There are to concrete implementations, one using Spring for configuration and one using Cinnamon's own XML configuration format. But alternatively you could also create your own subclass of this base servlet and use a custom ConfigurationBuilder implementation.

The Servlet is just a very thin layer on top of the Cinnamon framework, so most parts of the framework (except for the web package) do not depend on the Servlet API or HTTP protocol. This decoupling may be useful for testing or unusual deployment scenarios.

Author:
Jens Halm
See Also:
Serialized Form

Constructor Summary
AbstractCinnamonServlet()
           
 
Method Summary
protected abstract  ConfigurationBuilder createConfigurationBuilder(ServletConfig config)
          Creates the ConfigurationBuilder implementation this Servlet should use.
protected  void doPost(HttpServletRequest request, HttpServletResponse response)
           
 void init(ServletConfig config)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, 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
 

Constructor Detail

AbstractCinnamonServlet

public AbstractCinnamonServlet()
Method Detail

init

public void init(ServletConfig config)
          throws ServletException
Specified by:
init in interface Servlet
Overrides:
init in class GenericServlet
Throws:
ServletException

doPost

protected void doPost(HttpServletRequest request,
                      HttpServletResponse response)
               throws ServletException,
                      IOException
Overrides:
doPost in class HttpServlet
Throws:
ServletException
IOException

createConfigurationBuilder

protected abstract ConfigurationBuilder createConfigurationBuilder(ServletConfig config)
Creates the ConfigurationBuilder implementation this Servlet should use.

There are two builtin implementation: SpringConfigurationBuilder which uses a Spring WebApplicationContext for configuration and XmlConfigurationParser which processes Cinnamon's own custom XML configuration format.

Parameters:
config - the ServletConfig for this servlet
Returns:
the ConfigurationBuilder implementation this Servlet should use