Class PortalRequestHandler

java.lang.Object
org.exoplatform.container.component.BaseComponentPlugin
org.exoplatform.web.WebRequestHandler
org.exoplatform.portal.application.PortalRequestHandler
All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin
Direct Known Subclasses:
PortalTemplateRequestHandler

public class PortalRequestHandler extends org.exoplatform.web.WebRequestHandler
Created by The eXo Platform SAS Dec 9, 2006
This is 'portal' handler, it handle the request of URLs that are routed by navigation controller (using urls parameter). This handler is registered to WebAppController by xml configuration.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final PortalApplicationFactory
     
    static final String
     
    static final org.exoplatform.web.controller.QualifiedName
    .
    protected static final org.exoplatform.services.log.Log
     
    protected static final String
     
    static final org.exoplatform.web.controller.QualifiedName
    .
    static final org.exoplatform.web.controller.QualifiedName
    .
    static final org.exoplatform.web.controller.QualifiedName
    .

    Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin

    desc, name
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    computeRequestPath(String path, String portalName, String requestSiteType, org.exoplatform.portal.config.UserPortalConfigService portalConfigService, jakarta.servlet.http.HttpServletRequest context)
     
    protected void
    endRequestPhaseLifecycle(PortalApplication app, PortalRequestContext context, List<org.exoplatform.web.application.ApplicationLifecycle> lifecycles, org.exoplatform.web.application.Phase phase)
     
    boolean
    execute(org.exoplatform.web.ControllerContext controllerContext)
    This method will handle incoming portal request.
     
    protected Locale
    getRequestLocale(org.exoplatform.web.ControllerContext controllerContext)
     
    protected boolean
     
    void
    onInit(org.exoplatform.web.WebAppController controller, jakarta.servlet.ServletConfig sConfig)
    Dispatched from WebAppController, after the portal servlet init function called, this method create and register PortalApplication to WebAppController PortalApplication creation can be customized by registering PortalApplicationFactory implementation using ServiceLoader
    protected void
    This method do the main job on processing a portal request: 1) Call onStartRequest() on each ApplicationLifecycle object
    2) Get the StateManager object from the PortalApplication (also referenced in the XML file)
    3) Use the StateManager to get a reference on the root UI component: UIApplication; the method used is restoreUIRootComponent(context)
    4) If the UI component is not the current one in used in the PortalContextRequest, then replace it
    5) Process decode on the PortalApplication
    6) Process Action on the PortalApplication
    7) Process Render on the UIApplication UI component
    8) call onEndRequest on all the ApplicationLifecycle
    9) Release the context from the thread
    protected boolean
    processRequest(org.exoplatform.web.ControllerContext controllerContext, jakarta.servlet.http.HttpServletRequest request, Locale requestLocale, String requestSiteName, String requestSiteType, String requestPath)
     
    protected void
    startRequestPhaseLifecycle(PortalApplication app, PortalRequestContext context, List<org.exoplatform.web.application.ApplicationLifecycle> lifecycles, org.exoplatform.web.application.Phase phase)
     

    Methods inherited from class org.exoplatform.web.WebRequestHandler

    onDestroy

    Methods inherited from class org.exoplatform.container.component.BaseComponentPlugin

    getDescription, getName, setDescription, setName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • HANDLER_NAME

      public static final String HANDLER_NAME
      See Also:
    • LOG

      protected static final org.exoplatform.services.log.Log LOG
    • REQUEST_PATH

      public static final org.exoplatform.web.controller.QualifiedName REQUEST_PATH
      .
    • REQUEST_SITE_TYPE

      public static final org.exoplatform.web.controller.QualifiedName REQUEST_SITE_TYPE
      .
    • REQUEST_SITE_NAME

      public static final org.exoplatform.web.controller.QualifiedName REQUEST_SITE_NAME
      .
    • LANG

      public static final org.exoplatform.web.controller.QualifiedName LANG
      .
    • APPP_ROVIDER

      protected static final PortalApplicationFactory APPP_ROVIDER
    • PORTAL_PUBLIC_PAGE_NOT_FOUND

      protected static final String PORTAL_PUBLIC_PAGE_NOT_FOUND
      See Also:
  • Constructor Details

    • PortalRequestHandler

      public PortalRequestHandler()
  • Method Details

    • getHandlerName

      public String getHandlerName()
      Specified by:
      getHandlerName in class org.exoplatform.web.WebRequestHandler
    • onInit

      public void onInit(org.exoplatform.web.WebAppController controller, jakarta.servlet.ServletConfig sConfig) throws Exception
      Dispatched from WebAppController, after the portal servlet init function called, this method create and register PortalApplication to WebAppController PortalApplication creation can be customized by registering PortalApplicationFactory implementation using ServiceLoader
      Overrides:
      onInit in class org.exoplatform.web.WebRequestHandler
      Throws:
      Exception
      See Also:
    • execute

      public boolean execute(org.exoplatform.web.ControllerContext controllerContext) throws Exception
      This method will handle incoming portal request. It gets a reference to the WebAppController Here are the steps done in the method:
      1) Get the PortalApplication reference from the controller
      2) Create a PortalRequestContext object that is a convenient wrapper on all the request information
      3) Get the collection of ApplicationLifecycle referenced in the PortalApplication and defined in the webui-configuration.xml of the portal application
      4) Set that context in a ThreadLocal to easily access it
      5) Check if user have permission to access portal, if not, send 403 status code, if user has not login, redirect to login page
      6) dispatch to processRequest method, this is protected method, we can extend and override this method to write a new requestHandler base on PortalRequestHandler
      Specified by:
      execute in class org.exoplatform.web.WebRequestHandler
      Throws:
      Exception
    • processRequest

      protected boolean processRequest(org.exoplatform.web.ControllerContext controllerContext, jakarta.servlet.http.HttpServletRequest request, Locale requestLocale, String requestSiteName, String requestSiteType, String requestPath) throws Exception
      Throws:
      Exception
    • getRequiresLifeCycle

      protected boolean getRequiresLifeCycle()
      Specified by:
      getRequiresLifeCycle in class org.exoplatform.web.WebRequestHandler
    • processRequest

      protected void processRequest(PortalRequestContext context, PortalApplication app) throws Exception
      This method do the main job on processing a portal request: 1) Call onStartRequest() on each ApplicationLifecycle object
      2) Get the StateManager object from the PortalApplication (also referenced in the XML file)
      3) Use the StateManager to get a reference on the root UI component: UIApplication; the method used is restoreUIRootComponent(context)
      4) If the UI component is not the current one in used in the PortalContextRequest, then replace it
      5) Process decode on the PortalApplication
      6) Process Action on the PortalApplication
      7) Process Render on the UIApplication UI component
      8) call onEndRequest on all the ApplicationLifecycle
      9) Release the context from the thread
      Parameters:
      context -
      app -
      Throws:
      Exception
    • startRequestPhaseLifecycle

      protected void startRequestPhaseLifecycle(PortalApplication app, PortalRequestContext context, List<org.exoplatform.web.application.ApplicationLifecycle> lifecycles, org.exoplatform.web.application.Phase phase)
    • endRequestPhaseLifecycle

      protected void endRequestPhaseLifecycle(PortalApplication app, PortalRequestContext context, List<org.exoplatform.web.application.ApplicationLifecycle> lifecycles, org.exoplatform.web.application.Phase phase)
    • computeRequestPath

      protected String computeRequestPath(String path, String portalName, String requestSiteType, org.exoplatform.portal.config.UserPortalConfigService portalConfigService, jakarta.servlet.http.HttpServletRequest context) throws Exception
      Throws:
      Exception
    • getRequestLocale

      protected Locale getRequestLocale(org.exoplatform.web.ControllerContext controllerContext)