Class PortletApplication

java.lang.Object
org.exoplatform.container.component.BaseComponentPlugin
org.exoplatform.web.application.Application
org.exoplatform.webui.application.WebuiApplication
org.exoplatform.webui.application.portlet.PortletApplication
All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin

public class PortletApplication extends WebuiApplication
May 26, 2006 A portlet application. Every call made to a portlet deployed in eXo PC - and using eXo web framework - is going through this class
  • Field Summary

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

    Fields inherited from class org.exoplatform.web.application.Application

    EXO_GADGET_TYPE, EXO_PORTAL_TYPE, EXO_PORTLET_TYPE, JSR168_APPLICATION_TYPE, WSRP_TYPE

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

    desc, name
  • Constructor Summary

    Constructors
    Constructor
    Description
    PortletApplication(javax.portlet.PortletConfig config)
    This constructor has 2 purposes: 1) recreate the application id 2) configure the resource resolver to look in different UIR scheme (here app: and par:)
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
     
     
     
     
     
    void
    processAction(javax.portlet.ActionRequest req, javax.portlet.ActionResponse res)
    The processAction() method is the one modelled according to the Portlet API specification The process is quite simple and here are te different steps done in the method: 1) The current instance of the WebuiRequestContext (stored in a ThreadLocal in the class) is referenced 2) A new request context of type PortletRequestContext (which extends the class WebuiRequestContext) is created as a child of the current context instance 3) The new context is place inside the ThreadLocal and hence overides its parent one there, only for the portlet request lifeciclye 4) The method onStartRequest() is called in all the ApplicationLifecycle objects referenced in the webui configuration XML file 5) The StateManager object (in case of portlet it is an object of type ParentAppStateManager) is used to get the RootComponent also referenced in the XML configuration file 6) The methods processDecode(UIApplication, WebuiRequestContext) and processAction(UIApplication, WebuiRequestContext) are then called 7) Finally, a flag, to tell that the processAction phase was done, in the context is set to true and the parent context is restored in the Threadlocal
    void
    processEvent(javax.portlet.EventRequest req, javax.portlet.EventResponse res)
    This method is called when a JSR 286 event is targeting the current portlet.
    void
    render(javax.portlet.RenderRequest req, javax.portlet.RenderResponse res)
    The render method business logic is quite similar to the processAction() one.
    void
    serveResource(javax.portlet.ResourceRequest req, javax.portlet.ResourceResponse res)
    This method is called when a JSR 286 serveResource lifecycle method is targeting the current portlet.

    Methods inherited from class org.exoplatform.web.application.Application

    getApplicationLifecycle, getApplicationServiceContainer, getAttribute, getResourceResolver, onDestroy, setApplicationLifecycle, setAttribute, setResourceResolver

    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

    • log

      protected static org.exoplatform.services.log.Log log
    • PORTLET_EVENT_VALUE

      public static final String PORTLET_EVENT_VALUE
      See Also:
  • Constructor Details

    • PortletApplication

      public PortletApplication(javax.portlet.PortletConfig config)
      This constructor has 2 purposes: 1) recreate the application id 2) configure the resource resolver to look in different UIR scheme (here app: and par:)
  • Method Details

    • getApplicationId

      public String getApplicationId()
      Specified by:
      getApplicationId in class org.exoplatform.web.application.Application
    • getApplicationName

      public String getApplicationName()
      Specified by:
      getApplicationName in class org.exoplatform.web.application.Application
    • getApplicationGroup

      public String getApplicationGroup()
      Specified by:
      getApplicationGroup in class org.exoplatform.web.application.Application
    • getApplicationType

      public String getApplicationType()
      Specified by:
      getApplicationType in class org.exoplatform.web.application.Application
    • getResourceBundle

      public ResourceBundle getResourceBundle(Locale locale)
      Specified by:
      getResourceBundle in class org.exoplatform.web.application.Application
    • getOwnerResourceBundle

      public ResourceBundle getOwnerResourceBundle(String username, Locale locale)
      Specified by:
      getOwnerResourceBundle in class org.exoplatform.web.application.Application
    • getApplicationInitParam

      public String getApplicationInitParam(String name)
      Specified by:
      getApplicationInitParam in class WebuiApplication
    • processAction

      public void processAction(javax.portlet.ActionRequest req, javax.portlet.ActionResponse res) throws Exception
      The processAction() method is the one modelled according to the Portlet API specification The process is quite simple and here are te different steps done in the method: 1) The current instance of the WebuiRequestContext (stored in a ThreadLocal in the class) is referenced 2) A new request context of type PortletRequestContext (which extends the class WebuiRequestContext) is created as a child of the current context instance 3) The new context is place inside the ThreadLocal and hence overides its parent one there, only for the portlet request lifeciclye 4) The method onStartRequest() is called in all the ApplicationLifecycle objects referenced in the webui configuration XML file 5) The StateManager object (in case of portlet it is an object of type ParentAppStateManager) is used to get the RootComponent also referenced in the XML configuration file 6) The methods processDecode(UIApplication, WebuiRequestContext) and processAction(UIApplication, WebuiRequestContext) are then called 7) Finally, a flag, to tell that the processAction phase was done, in the context is set to true and the parent context is restored in the Threadlocal
      Throws:
      Exception
    • processEvent

      public void processEvent(javax.portlet.EventRequest req, javax.portlet.EventResponse res) throws Exception
      This method is called when a JSR 286 event is targeting the current portlet. The event is transformed in a WebUI event using the convention that the 286 event name will target the EventNameActionListener class of one of the UIComponent in the portlet uicomponent tree The event value is passed as an attribute of the PortletRequestContext
      Throws:
      Exception
    • serveResource

      public void serveResource(javax.portlet.ResourceRequest req, javax.portlet.ResourceResponse res) throws Exception
      This method is called when a JSR 286 serveResource lifecycle method is targeting the current portlet. 1) The current instance of the WebuiRequestContext (stored in a ThreadLocal in the class) is referenced 2) A new request context of type PortletRequestContext (which extends the class WebuiRequestContext) is created as a child of the current context instance 3) The new context is place inside the ThreadLocal and hence overides its parent one there, only for the portlet request lifecycle 4) The method onStartRequest() is called in all the ApplicationLifecycle objects referenced in the webui configuration XML file 5) The StateManager object (in case of portlet it is an object of type ParentAppStateManager) is used to get the RootComponent also referenced in the XML configuration file 6) The method serveResource of UIPortletApplication is called 7) Finally, the method onEndRequest() is called on every ApplicationLifecycle referenced in the portlet configuration XML file and the parent WebuiRequestContext is restored
      Throws:
      Exception
    • render

      public void render(javax.portlet.RenderRequest req, javax.portlet.RenderResponse res) throws Exception
      The render method business logic is quite similar to the processAction() one. 1) A PortletRequestContext object is created (or extracted from the cache if it already exists) and initialized 2) The PortletRequestContext replaces the parent one in the WebuiRequestContext ThreadLocal object 3) If the portal has already called the portlet processAction() then the call to all onStartRequest of the ApplicationLifecycle has already been made, otherwise we call them 4) The ParentStateManager is also used to get the UIApplication, as we have seen it delegates the call to the PortalStateManager which caches the UI component root associated with the current application 5) the processRender() method of the UIPortletApplucaton is called 6) Finally, the method onEndRequest() is called on every ApplicationLifecycle referenced in the portlet configuration XML file and the parent WebuiRequestContext is restored
      Throws:
      Exception