Hi Guys,
While developing the portletfaces-bridge [1] I discovered a Servlet-API dependency with
the way JSF 2.0 implements detection of resource requests.
Specifically, javax.faces.application.Resource.getRequestPath() [2] states that
"/javax.faces.resource" [3] must be part of the return value of the path.
Now... it's true that the Javadoc for
javax.faces.application.Resource.getRequestPath() [2] adds:
"Make it portlet safe by passing the result through
ViewHandler.getResourceURL(javax.faces.context.FacesContext, java.lang.String)" [4]
... but this isn't good enough. To make a long story short, the Portlet 2.0 API does
not provide access to the URL requested by the userAgent/browser. It only provides access
to request parameters. So there is no way for a portlet bridge to examine the request
path. In fact, the behavior of ExternalContext.getRequestPathInfo() [5] and
ExternalContext.getRequestServletPath() [6] are undefined for portlets, because there are
no equivalent methods in the javax.portlet.PortletRequest class like there is for
javax.servlet.http.HttpServletRequest. So it's just not appropriate for a JSF
implementation to rely on them to behave like their Servlet API counterparts.
Therefore, in order to provide compatibility with portlets, I propose that for JSF 2.1, we
deprecate:
- The presence of "/javax.faces.resource/resource-name" in the path
And change it to this:
- The presence of a "javax.faces.resource" request parameter with value
resource-name.
Using this method, custom implementations of ResourceHandler that are present in
component-suites can add additional request parameters to help them identify themselves as
a custom resource request.
Thoughts? I've got it coded up in the bridge and it seems to be working fine.
Thanks guys,
Neil
[1]
http://www.portletfaces.org/projects/portletfaces-bridge
[2]
https://javaserverfaces.dev.java.net/nonav/docs/2.0/javadocs/javax/faces/...
[3]
https://javaserverfaces.dev.java.net/nonav/docs/2.0/javadocs/javax/faces/...
[4]
https://javaserverfaces.dev.java.net/nonav/docs/2.0/javadocs/javax/faces/...,
java.lang.String)
[5]
https://javaserverfaces.dev.java.net/nonav/docs/2.0/javadocs/javax/faces/...
[6]
https://javaserverfaces.dev.java.net/nonav/docs/2.0/javadocs/javax/faces/...