Search This Blog

Sunday, January 10, 2016

What are the core objects of the JSR 286 API in IBM WebSphere Portal 8.5?
  1. PortletConfig class: The PortletConfig class functions similarly to ServletConfig in that it uses the following common methods to provide access to the portlet’s configuration:
    • getInitParameter(): Gets initialization parameters.
    • getPortletName(): Gets the portlet’s name
    • getResourceBundle(): Gets the resource bundle for this portlet
    • getSupportedLocales(): Gets the list of supported locales
    • ResourceBundle portletBundle = null;  
      portletBundle = getPortletConfig().getResourceBundle(request.getLocale());

       2. PortletContext class : The PortletContext class functions similarly to ServletContext in that it                      provides access to information about the portlet container.

          The following methods store and retrieve objects that are common to all users of the portlet:
    • setAttribute().
    • getAttribute().
         The getRequestDispatcher() method gets a dispatcher to call other portlet resources. 

         Example :

        
 PortletRequestDispatcher rd =getPortletContext().getRequestDispatcher("/jsps/DisplayCompany.jsp");   
 rd.include(request, response);   


        The PortletContext object defines a portlet view of the portlet container. 
        The PortletContext  also makes resources available to the portlet. 
        By using the context, a portlet can access the portlet log and obtain URL references             to resources. 
        One context is available for each portlet application per Java virtual machine (JVM).
        (A portlet application is a collection of portlets and servlets installed by way of a web             archive   file.)
        As a web application, a portlet application also has a servlet context.        The portlet context uses most of its functionality from the servlet context of the  portlet
       application.
       Attributes stored in the context are global for all users and all components in the portlet 
       application

      3.The PortletRequest class: uses the following sub-interfaces:
  • ActionRequestPassed into the processAction() method.
  • RenderRequestPassed into the doView(), doEdit() methods.
  • EventRequestPassed into the processEvent() method (for portlets subscribing to events).
  • ResourceRequest.
  • Passed into the serveResource() method (for resource serving portlets).
       4.PortletResponse class:Each portlet life-cycle phase has an implementation of the 
        PortletResponse Class:    
  • ActionResponse.
  • RenderResponse.
  • EventResponse.
  • ResourceResponse.
        5.PortletSession class:The PortletSession provides short-term access to objects on 
         behalf of the user. PortletSession has the following characteristics:

           Session data is specific to individual users. Objects that are placed in the session are available 
           for the life of the session either for a specific user-and-portlet combination or to a user across
           all portlets within a portlet application.
          Objects are stored in the session when the object must be available to a subsequent request or
          when the object is shared across multiple portlets in the same application. 
          Objects are removed when the object is no longer required.
          Sessions are invalidated when all objects in the session are no longer required.
          The PortletSession provides a way to identify a user across more than one request and to store
          transient information about that user. It is created per user client per portlet application.
         A portlet can bind an object attribute into a PortletSession by name. The PortletSession 
         interface defines two scopes for storing objects:
  • APPLICATION_SCOPE 
               All objects stored in the session by using the APPLICATION_SCOPE must be available to 
               all the portlets, servlets, and JSP that belong to the same portlet application and that handles 
               a request identified as being a part of the same session.
  •   PORTLET_SCOPE
                 Objects stored in the session using the PORTLET_SCOPE must be available to the 
                 portlet during requests for the same portlet window from which the objects where stored. 

No comments:

Post a Comment