Uploaded image for project: 'MyFaces Portlet Bridge'
  1. MyFaces Portlet Bridge

Bridge phase listeners have portlet dependecy but can be executed in a servlet request yielding ClassCastException


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0, 2.0.0, 3.0.0-alpha
    • Fix Version/s: 3.0.0-alpha
    • Component/s: Impl
    • Labels:


      The Bridge temporarily installs its own phase listeners to provide a variety of behaviors . As phase listeners are controlled by the lifecycle and there (can be) is only 1 lifecycle instance per application all listeners are called whenever the lifecycle is run. Because you can have distinct portlets in a application and the application can also run as a servlet care must be taken to only execute the phase listener if its truly the target of the execution. The bridge properly handles this for the multiple portlet case by checking that the event's FacesContext is the same as the thread's (current instances). Unfortunately this doesn't prevent the code from executing in the servlet case. I.e. if a portlet request comes in an is being processed by the bridge it will install the phase listener. If a second request happens concurrently but accesses this app as a servlet, we will execute the bridge's phase listener in this servlet request. This results in a ClassCastException as the code accesses the request object as a PortletRequest (but its not).

      Simple fix is to expand the test to only execute the phase listener is the FacesContext instance match and its a Portlet request.




            • Assignee:
              mike_freedman Michael Freedman
              mike_freedman Michael Freedman
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: