org.araneaframework.http.core
Class BaseAraneaDispatcherServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.araneaframework.http.core.BaseAraneaDispatcherServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
AraneaSpringDispatcherServlet

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

Aranea's main servlet. Routes GET & POST methods to the root component's service(HttpServletRequest, HttpServletResponse) method.

Enriches the environment with objects of ServletContext and ServletConfig. They can be accessed later from the environment under the keys ServletContext.class and ServletConfig.class respectively.

Author:
"Toomas Römer"
See Also:
Serialized Form

Constructor Summary
BaseAraneaDispatcherServlet()
           
 
Method Summary
protected  void buildAlternateRootComponents()
          Should build all alternate root component hierarchies, if applicable.
protected abstract  ServletServiceAdapterComponent buildRootComponent()
          Builds the default (and in most cases only) root component of this servlet.
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  Map getEnvironmentEntries()
           
protected  ServletServiceAdapterComponent getServiceAdapter(javax.servlet.http.HttpServletRequest req)
          Returns ServletServiceAdapterComponent that should service the given request.
protected  Map getServletEnvironmentMap()
           
 void init()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, 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

BaseAraneaDispatcherServlet

public BaseAraneaDispatcherServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

doGet

protected void doGet(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp)
              throws javax.servlet.ServletException,
                     IOException
Throws:
javax.servlet.ServletException
IOException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse resp)
               throws javax.servlet.ServletException,
                      IOException
Throws:
javax.servlet.ServletException
IOException

getServiceAdapter

protected ServletServiceAdapterComponent getServiceAdapter(javax.servlet.http.HttpServletRequest req)
Returns ServletServiceAdapterComponent that should service the given request. Default implementation returns component built by buildRootComponent().

Returns:
ServletServiceAdapterComponent that should service the given request
Since:
1.0.7

buildRootComponent

protected abstract ServletServiceAdapterComponent buildRootComponent()
Builds the default (and in most cases only) root component of this servlet. All the requests (GET & POST) through some root component, when no alternate root components are defined, requests will always go through the root component built here.

Returns:
default root component

buildAlternateRootComponents

protected void buildAlternateRootComponents()
Should build all alternate root component hierarchies, if applicable. Base implementation does not build any. If this is overridden, also getServiceAdapter(HttpServletRequest) should be overriden to choose the correct component hierarchy for processing the request.

Since:
1.0.7

getEnvironmentEntries

protected Map getEnvironmentEntries()

getServletEnvironmentMap

protected Map getServletEnvironmentMap()
Returns:
map with same entries as getEnvironmentEntries() plus servlet container specific entries (ServletContext, ServletConfig)
Since:
1.0.7