8 Replies Latest reply on Jun 10, 2011 5:15 PM by Brad Posner-Oracle

    Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper

    667822
      Just Released: Developing JSF Portlets with WebLogic Portal Whitepaper

      A supplemental developer's guide has been published to help guide WLP 10.x customers that wish to use JSF as the web framework for building portlets on WebLogic Portal. This is a sizable document (150 pages) that covers a large number of topics. It also coaches developers on best practices and common pitfalls.

      Important: It also clarifies the supported configuration of JSF within Portal Web Projects. Workshop for WebLogic by default configures a web project in a configuration that is not supported by WebLogic Portal. The guide explains how to address this:

      * Change from the unsupported MyFaces JSF implementation to the supported Sun Reference Implementation (RI)
      * Change from the unsupported "client" STATE_SAVING_METHOD to the supported "server"

      The guide can be downloaded here:

      http://download.oracle.com/technology/products/weblogic/portal/weblogic-portal-jsf-whitepaper.pdf

      To help internet searches locate this document, the table of contents is reproduced below:

      Introduction
      1.1. Prerequisites...................................................................... 8
      1.2. Applicable Versions............................................................ 8
      1.3. Native Portlet Bridges and Standard Portlet Bridges .......... 8
      1.4. JSF Portlet Support Roadmap ........................................... 9
      1.5. Whitepaper Structure ....................................................... 10
      1.6. Look Before You Leap ..................................................... 10
      1.7. For More Information........................................................ 10


      Part 1: Converting JSF Applications into Portlets
      2. IDE Support for JSF Portlets Chapter ...................................... 12
      2.1. Workshop for WebLogic – WebLogic Portal's Supported IDE 12
      2.2. Workshop Features for JSF Support in WebLogic Portal.. 12
      3. Introduction to JSF Portlets Chapter ........................................ 18
      3.1. Creating Your First JSF Portlet......................................... 18
      3.2. Essentials of JSF Portlet Views........................................ 21
      3.3. WebLogic Portal Artifacts................................................. 22
      4. Configuring JSF within WebLogic Portal Chapter..................... 24
      4.1. JSF Library Modules in WebLogic Server ........................ 24
      4.2. Installing the JSF Libraries into a Portal Web Project ....... 25
      4.3. JSF Configuration Settings............................................... 27
      4.4. Configuring JSF 1.2 ......................................................... 29
      4.5. Building an Unsupported JSF Implementation Library Module 31
      4.6. Faces Configuration is Web Application Scoped.............. 31
      5. Navigation within a JSF Portlet Chapter................................... 33
      5.1. Navigating within a Portlet with the JSF Controller ........... 33
      5.2. Redirects.......................................................................... 34
      6. Namespacing Chapter ............................................................. 35
      6.1. Namespacing Managed Bean Names.............................. 35
      6.2. Client ID Namespacing with the View and Subview Components 35
      6.3. Client ID Namespacing with the WLP NamingContainer .. 36
      7. Logging, Iterative Development, and Debugging Chapter ........ 39
      7.1. Logging............................................................................ 39
      7.2. Iterative Development ...................................................... 39
      7.3. Debugging ....................................................................... 40
      8. Custom JavaScript Chapter ..................................................... 42
      8.1. DOM Manipulation within a JSF ....................................... 42
      8.2. Form Validation within a JSF Portlet ................................ 45
      9. Preparing JSF Portlets for Production Chapter ........................ 46
      9.1. Configuration.................................................................... 46
      9.2. Performance and Scalability............................................. 47
      9.3. Security............................................................................ 49
      9.4. Localization...................................................................... 50


      Part 2: Interacting with the Portal Environment
      10. Native Bridge Architecture Chapter ...................................... 54
      10.1. Container Architecture Overview.................................. 54
      10.2. Container Architecture.................................................. 54
      10.3. Container Interactions .................................................. 55
      11. Interportlet Communication Chapter .................................... 56
      11.1. Using Session and Request Attributes for IPC (Anti-pattern) 56
      11.2. Using the WLP Event Facility for IPC with JSF Portlets 56
      11.3. Notifications ................................................................. 60
      11.4. Comparison of the IPC Approaches ............................. 60
      12. Scopes Chapter ................................................................... 62
      12.1. Conceptual Scopes for Standard JSF Applications ...... 62
      12.2. Conceptual Scopes for Portal Applications................... 63
      12.3. Implementation Patterns for Portal Scopes .................. 63
      13. State Sharing Patterns Chapter ........................................... 66
      13.1. State Sharing Concepts ............................................... 66
      13.2. HttpSession Versus HttpServletRequest ...................... 66
      13.3. Base Code for HttpSession Patterns ............................ 67
      13.4. Single Portlet Pattern ................................................... 68
      13.5. Multiple Portlet Patterns ............................................... 69
      14. Rendering Lifecycles Chapter .............................................. 77
      14.1. WLP and JSF Lifecycles .............................................. 77
      14.2. Invocation Order of WLP and JSF Lifecycle Methods... 77
      14.3. Accessing WLP Context Objects from JSF Managed Beans 78
      15. Portal Navigation Chapter .................................................... 80
      15.1. Programmatically Constructing JSF Portlet URLs ........ 80
      15.2. Changing the Active Portal Page.................................. 80
      15.3. Redirects within a Portal............................................... 83
      16. Ajax Enablement Chapter .................................................... 85
      16.1. Ajax in JSF Portlets...................................................... 85
      16.2. Partial Page Rendering Pattern.................................... 85
      16.3. Stateless API Request Pattern ..................................... 86
      16.4. Portlet Aware API Request Pattern .............................. 87
      16.5. Controlling the WLP Ajax Framework........................... 91
      17. Additional WLP Features Chapter........................................ 93
      17.2. Portlet Container Features ........................................... 93
      17.3. Portal Container Features ............................................ 98
      18. Example: Implementing a Login Portlet Chapter .................. 99
      18.1. Login Portlet Motivation................................................ 99
      18.2. Login Portlet Design..................................................... 99
      18.3. Login Portlet Implementation...................................... 101


      Part 3: Integrating Third Party Libraries
      19. Integration Overview Chapter............................................. 111
      19.1. Types of Libraries....................................................... 111
      19.2. Roadmap for MyFaces Trinidad and ADF Faces Rich Client 111
      20. Using the Facelets View Technology Chapter.................... 113
      20.1. Introduction to Facelets .............................................. 113
      20.2. Configuring Facelets Support ..................................... 113
      21. Using the Apache MyFaces Tomahawk Component Library Chapter 115
      21.1. What is Apache MyFaces Tomahawk? ...................... 115
      21.2. Support for Tomahawk in WLP................................... 115
      21.3. Tomahawk Component List........................................ 116
      21.4. Installing and Configuring Tomahawk......................... 119
      21.5. Resolving the Duplicate ID Issue................................ 120
      21.6. Referring to Resources .............................................. 120
      21.7. forceId Attribute.......................................................... 124
      21.8. File Upload................................................................. 125
      22. Using the Apache Beehive Navigation Controller Chapter . 126
      22.1. Apache Beehive Page Flow ....................................... 126
      22.2. JSF and Page Flows .................................................. 126
      22.3. Configuring the JSF Integration with Page Flows ....... 127


      Appendices
      23. Appendix 1: Consolidated List of Best Practices ................ 130
      24. Appendix 2: Known Issues and Workarounds.................... 132
      24.1. CR383659, CR383662 Inconsistent failures with JSF portlets 132
      24.2. CR342124: IllegalStateException due to duplicate client-id 132
      24.3. CR384916: IllegalStateException due to duplicate client-id when using certain components such as Tomahawk and Trinidad...... 133
      24.4. CR361477 Problems with the integration of JSF portlets with Apache Beehive Page Flows.................................................................. 133
      24.5. CR377945 JSF 1.2 suffers from a memory leak during iterative development .............................................................................. 134
      25. Appendix 3: The JSFPortletHelper Class ........................... 135
      26. Appendix 4: The CleanupPhaseListener Class .................. 147
        • 1. Re: Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper
          Brad Posner-Oracle
          This is fantastic work. Thank you Peter.
          • 2. Re: Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper
            670987
            Many Thanks Peter. I posted a message Jan 28, 2009 3:59 PM regarding the same. Now my issue was resolved
            • 3. Re: Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper
              684165
              first of all, I would like to thank you for the whitepaper...its really help me so much since I'm a newbie for developing a portal with jsf portlet...

              I have a little problem here when I was trying the login chapter in my computer...
              I use WLP 10gR3 for the environment...
              I cannot perform logout process because i found an error...
              the error message are:

              +<Feb 12, 2009 4:34:50 PM ICT> <Error> <netuix> <BEA-423166> <An exception or error occurred in the backing file oracle.samples.wlp.jsf.portlets.login.JSFLoginPortletBacking while executing its handlePostbackData method. It was java.lang.NullPointerException+
              java.lang.NullPointerException
              at oracle.samples.wlp.jsf.portlets.login.JSFLoginPortletBacking.isAuthenticated(JSFLoginPortletBacking.java:57)
              at oracle.samples.wlp.jsf.portlets.login.JSFLoginPortletBacking.handlePostbackData(JSFLoginPortletBacking.java:26)
              at com.bea.netuix.servlets.controls.Backable$Impl.handlePostbackData(Backable.java:166)
              at com.bea.netuix.servlets.controls.AdministeredBackableControl.handlePostbackData(AdministeredBackableControl.java:83)
              at com.bea.netuix.servlets.controls.window.Window.handlePostbackData(Window.java:606)
              Truncated. see log file for complete stacktrace
              +>+

              meanwhile, I have modified the return value of isAuthenticated() method in JSFLoginPortletBacking class since its call JSFPortletHelper.isAuthenticated() method with a parameter...
              back to the error problem, I think it's caused by getUserPrincipal process return null value from FacesContext...
              cmiimw...
              but why FacesContext cannot return a Principal object?...
              is there anything that i missed?...
              txh...
              • 4. Re: Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper
                667822
                I think I see it. It was difficult to keep the code in my Eclipse project in sync with the formatted document, and it looks like the JSFPortletHelper is missing the following method in the appendix:

                     /**
                     * Is the current user authenticated?
                     * Can be called from any web application class.
                     *
                     * @return true if the user is authenticated, false if not
                     */
                     static public boolean isAuthenticated(HttpServletRequest request) {
                          Principal principal = request.getUserPrincipal();
                          return principal != null;
                     }

                The backing file should be invoking this one, which will not NPE when called outside of the Faces lifecycle. Please let me know if this fixes your issue. I plan to reissue the whitepaper in the coming weeks with some additional information. Will include this fix - but please verify. Thanks!
                • 5. Re: Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper
                  684165
                  Well, its work...
                  but with little modification in JSFLoginPortletRequestBean class ...

                  // GETTERS AND SETTERS
                  /**
                  * @return true if the user is authenticated
                  */
                  public boolean isAuthenticated() {
                  return JSFPortletHelper.isAuthenticated(JSFPortletHelper.getRequest());
                  }

                  btw, please let me know if the newer whitepaper just has been released...
                  txh alot...

                  Edited by: gubrak on Feb 12, 2009 7:41 PM
                  • 6. Re: Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper
                    PaKo
                    Hi Peter!

                    First, I wish to thank you for the great work.

                    We followed your whitepaper and managed to deploy a JSF portlet on WLS.

                    But we are not able to register it (consume it) as remote portlet in Oracle Portal 10.1.4. The error log is as follows:
                    An error occurred while trying to refresh the provider. (WWC-43190)
                    An error occurred during the call to the WSRP Provider: 
                    java.rmi.RemoteException: serialization error: serialization error: 
                    unexpected null value for literal data; nested exception is:
                    serialization error: serialization error: unexpected null value for literal data
                    com.sun.xml.rpc.encoding.SerializationException: serialization error: 
                    serialization error: unexpected null value for literal data
                    com.sun.xml.rpc.encoding.SerializationException: serialization error: 
                    unexpected null value for literal data
                    Java stack trace from root exception:
                    unexpected null value for literal data
                    at
                    oracle.webdb.wsrp.RegistrationContext_LiteralSerializer.doSerialize(RegistrationContext_LiteralSerializer.java:107) 
                    
                    at
                    com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.internalSerialize(LiteralObjectSerializerBase.java:119) 
                    
                    at
                    com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.serialize(LiteralObjectSerializerBase.java:70) 
                    
                    at
                    oracle.webdb.wsrp.GetServiceDescription_LiteralSerializer.doSerialize(GetServiceDescription_LiteralSerializer.java:88) 
                    
                    at
                    com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.internalSerialize(LiteralObjectSerializerBase.java:119) 
                    
                    at
                    com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.serialize(LiteralObjectSerializerBase.java:70) 
                    
                    at
                    com.sun.xml.rpc.client.StreamingSender._writeRequest(StreamingSender.java:473) 
                    
                    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:62)
                    at
                    oracle.webdb.wsrp.WSRP_v1_ServiceDescription_PortType_Stub.getServiceDescription(WSRP_v1_ServiceDescription_PortType_Stub.java:63) 
                    
                    at
                    oracle.webdb.wsrp.client.design.v1.OraWSRP_v1_ServiceDescription_PortType.getServiceDescription(Unknown
                    Source)
                    Do you have any idea why this happens? Or you can provide some useful links to WLP -Oracle Portal federation?

                    Thank you and best regards,

                    PaKo
                    • 7. Re: Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper
                      650850
                      Hello PaKo,

                      I don't believe using Oracle Portal to consume portlets (of any type) from a WLP producer has been certified as working yet. From the error message you are getting from Oracle Portal, it looks like it may not be fully working. This probably has nothing to do with the type of portlet (JSF) you are deploying on WLP.

                      From the exception message, it looks like Oracle Portal hasn't even contacted the WLP producer yet- the GetServiceDescription operation is the very first step in a WSRP setup process, and it looks like Oracle Portal is having an issue creating the request for the service description. If there are any optional fields in the tool you are using to bring in this remote portlet, you might try giving those optional fields values; that might get around this issue.

                      Unfortunately, I don't have any other suggestions for what you could try at this time.

                      Kevin
                      • 8. Re: Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper
                        Brad Posner-Oracle
                        NOTE: This whitepaper has been retired. The information from this whitepaper has been incorporated into the official documentation for WebLogic Portal versions 10.3 and 10.3.2.