com.acsinet_solutions.cetia4.controller.rest
Class AbstractRestServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.acsinet_solutions.cetia4.controller.rest.AbstractRestServlet
All Implemented Interfaces:
AttributeKeys, ControllerConstants, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
DynamicRestServlet, RestServlet

public abstract class AbstractRestServlet
extends javax.servlet.http.HttpServlet
implements ControllerConstants

Basic class that implements common functionality for both REST servlets that implement a module themselves, and those that delegate implementation to external modules.

A REST-based servlet; implements basic REST support in a basic servlet. Get and Post requests are forwarded to different methods.

The servlet name configured in web.xml for subclasses of this servlet is important, as it will be used for naming the module.

The servlet mapping is also important, and it must correspond to the servlet name. For example, if the servlet name is "notas", the servlet mapping must be "/notas/*" so the internal navigation and REST facilities will work well.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.acsinet_solutions.cetia4.controller.ControllerConstants
_METHOD_PARAM, _PAGE_PARAM, _ROOT_PARAM, DEFAULT_VIEW, ERROR_URL, ERROR_VIEW, LOAD_CANCEL, LOAD_CURRENT, LOAD_DEFAULT, LOAD_ERROR, LOAD_PREVIOUS
 
Fields inherited from interface com.acsinet_solutions.cetia4.controller.AttributeKeys
_BUNDLE_KEY, _CONFIGURATION_KEY, _DEFAULT_CONTROLLER_KEY, _FORM_ACTION_KEY, _FORM_ATTRIBUTE_KEY, _LOCALE_KEY, _MESSAGE_KEY, _NAVIGATION_FLOW_KEY, _PORTAL_PATH_KEY, _RENDER_PARAMETERS_KEY, _SERVICE_LOCATOR_KEY, _SESSION_KEY, _SYSTEM_EXCEPTION_KEY, _VALIDATION_EXCEPTION_KEY
 
Constructor Summary
AbstractRestServlet()
          Public constructor that registers the default handlers
 
Method Summary
protected  void doDelete(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void doPut(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 Configuration getConfiguration()
          Get the configuration instance that encapsulates configuration for the current servlet.
 ServiceLocator getLocator()
          Convenience method to get a reference to the configured service locator - if any.
 org.apache.commons.logging.Log getLogger()
          Get the logger for subclasses and helper classes
protected abstract  RestModule getRestModule()
          This is a factory abstract template method that will be overriden by subclasses to provide the Root Rest module that will be attended by the current instance.
 UserSessionManager getUserSessionManager()
          Get the session manager used to create the UserSession structures with the information of the current logged-in user.
 void init()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doHead, doOptions, 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

AbstractRestServlet

public AbstractRestServlet()
Public constructor that registers the default handlers

Method Detail

getLogger

public final org.apache.commons.logging.Log getLogger()
Get the logger for subclasses and helper classes


getLocator

public ServiceLocator getLocator()
Convenience method to get a reference to the configured service locator - if any.


getConfiguration

public Configuration getConfiguration()
Get the configuration instance that encapsulates configuration for the current servlet.


getUserSessionManager

public UserSessionManager getUserSessionManager()
Get the session manager used to create the UserSession structures with the information of the current logged-in user. This method is overridable.


getRestModule

protected abstract RestModule getRestModule()
This is a factory abstract template method that will be overriden by subclasses to provide the Root Rest module that will be attended by the current instance. This will be called just once during servlet initialization.


init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

doGet

protected final void doGet(javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

doPost

protected final void doPost(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

doPut

protected final void doPut(javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Overrides:
doPut in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

doDelete

protected final void doDelete(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws javax.servlet.ServletException,
                              java.io.IOException
Overrides:
doDelete in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException