Uploaded image for project: 'Portals Bridges (Retired)'
  1. Portals Bridges (Retired)
  2. PB-45

Should not use instanceof on Portlet request interfaces to distinguish ActionRequest from RenderRequest

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.0.1
    • jsf, struts
    • None
    • Undisclosed portal

    Description

      The struts and jsf bridge currently use in a few situations instanceof on a PortletRequest object to determine if a request is in the action or render phase.
      Although many/most portals use different implementation objects for ActionRequest and RenderRequest, this is certainly not a requirement by the portlet specification (JSR-168).

      More in general, instanceof should never be used with interfaces to distinguish implementations!

      The solution for the jsf and struts bridge is very simple: provide a specific request attribute indicating which type of request phase the portlet currently is in.
      The Struts bridge already uses and sets such an attribute and even uses this in most circumstances and for the jsf bridge this is easily added as well.

      This issue was reported on the Pluto developer mailing list by John Lewis (Portlet-MVC):
      http://www.mail-archive.com/pluto-dev%40portals.apache.org/msg01091.html

      Attachments

        Activity

          People

            ate Ate Douma
            ate Ate Douma
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: