Details
Description
When running an application on the MyFaces JSF portal bridge, I noticed the context path is always appended to the URI path in PortletViewHandlerImpl.getResourceURL() even if the path parameter already contains the context path.
My JSF portal application loads image resources and css files and when using the Sun portal bridge all the resources resolved. When attempt to use the MyFaces JSF portal bridge, the application failed to find the resources citing a java.io.FileNotFoundException for the resources. The resources that already contained the context path are prepened with another context path. The getResourceURL() method of PortletViewHandlerImpl ALWAYS prepends the context path to the path parameter without checking if it is already there.
I believe changing the getResourceURL() code to delegate this call to the handler.getResourceURL() method of (javax.faces.application.ViewHandler) would resolve the problem. I made this small change in my sandbox. The URLs with the context path did not get prepended and the application found all resources.
Is there a reason the PortletViewHandlerImpl does not delegate the getResourceURL() method that I am missing? If there is not a compelling reason not to delegate the call to the included ViewHandler, then perhaps we should delegate the call to javax.faces.application.ViewHandler. If there is a compelling reason perhaps we should add a check if the context path already exists in the path parameter.