Class AbstractHttpServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public abstract class AbstractHttpServlet
    extends javax.servlet.http.HttpServlet
    Created by The eXo Platform SAS Author : Nicolas Filotto nicolas.filotto@exoplatform.com 29 sept. 2009
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.servlet.ServletConfig config
      The filter configuration
      protected String servletContextName
      The Servlet context name
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void afterInit​(javax.servlet.ServletConfig config)
      Allows sub-classes to initialize
      protected ExoContainer getContainer()  
      javax.servlet.ServletContext getServletContext()  
      void init​(javax.servlet.ServletConfig config)
      protected void onPortalEnvironmentError​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
      Allow the sub classed to execute a task when the portal environment could not be set because no related portal container could be found
      protected void onService​(ExoContainer container, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
      Allow the sub classes to execute a task when the method service is called
      protected boolean requirePortalEnvironment()
      Indicates if it requires that a full portal environment must be set
      void service​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)  
      • Methods inherited from class javax.servlet.http.HttpServlet

        doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletInfo, getServletName, init, log, log
    • Field Detail

      • config

        protected javax.servlet.ServletConfig config
        The filter configuration
      • servletContextName

        protected String servletContextName
        The Servlet context name
    • Constructor Detail

      • AbstractHttpServlet

        public AbstractHttpServlet()
    • Method Detail

      • init

        public final void init​(javax.servlet.ServletConfig config)
                        throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Servlet
        Overrides:
        init in class javax.servlet.GenericServlet
        Throws:
        javax.servlet.ServletException
      • afterInit

        protected void afterInit​(javax.servlet.ServletConfig config)
                          throws javax.servlet.ServletException
        Allows sub-classes to initialize
        Parameters:
        config - the current servlet configuration
        Throws:
        javax.servlet.ServletException
      • service

        public final void service​(javax.servlet.http.HttpServletRequest req,
                                  javax.servlet.http.HttpServletResponse res)
                           throws javax.servlet.ServletException,
                                  IOException
        Overrides:
        service in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
        See Also:
        HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      • requirePortalEnvironment

        protected boolean requirePortalEnvironment()
        Indicates if it requires that a full portal environment must be set
        Returns:
        true if it requires the portal environment false otherwise.
      • onService

        protected void onService​(ExoContainer container,
                                 javax.servlet.http.HttpServletRequest req,
                                 javax.servlet.http.HttpServletResponse res)
                          throws javax.servlet.ServletException,
                                 IOException
        Allow the sub classes to execute a task when the method service is called
        Parameters:
        container - the eXo container
        req - the HttpServletRequest
        res - the HttpServletResponse
        Throws:
        javax.servlet.ServletException
        IOException
      • onPortalEnvironmentError

        protected void onPortalEnvironmentError​(javax.servlet.http.HttpServletRequest req,
                                                javax.servlet.http.HttpServletResponse res)
                                         throws javax.servlet.ServletException,
                                                IOException
        Allow the sub classed to execute a task when the portal environment could not be set because no related portal container could be found
        Parameters:
        req - the HttpServletRequest
        res - the HttpServletResponse
        Throws:
        javax.servlet.ServletException
        IOException
      • getContainer

        protected final ExoContainer getContainer()
        Returns:
        Gives the ExoContainer that fits best with the current context
      • getServletContext

        public javax.servlet.ServletContext getServletContext()
        Specified by:
        getServletContext in interface javax.servlet.ServletConfig
        Overrides:
        getServletContext in class javax.servlet.GenericServlet
        Returns:
        the current ServletContext