MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-33

Tomahawk's use of HttpServletRequest breaks JSF Portlets

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.8
    • Component/s: Portlet_Support
    • Labels:
      None

      Description

      I have a report of a user who wanted to use JSCookMenu in a portlet. This results in a ClassCastException because org.apache.myfaces.component.html.util.AddResource assumes that the underlying request object will be an HttpServletRequest.

      I will fix this for AddResource, but I suspect that there are other offending classes in Tomahawk.

      For future reference, you should always use methods from ExternalContext instead of doing (HttpServletRequest)ExternalContext.getRequest().

      If you MUST use features of HttpServletRequest that ExternalContext doesn't offer then you should use the PortletUtil to make sure that you don't break portlets. To tell if you are running in a portlet environment, you can say:

      org.apache.myfaces.portlet.PortletUtil.isPortletRequest(FacesContext facesContext)

      Note: calling PortletUtil does not put any dependency on the Portlet API.

      1. AddResource.patch
        2 kB
        Blazej Kepa
      2. AddResource.239380.patch
        4 kB
        Thomas Heute

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Stan Silvert
              Reporter:
              Stan Silvert
            • Votes:
              6 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development