Non-Faces request generates Faces response and FacesServlet prefix mapping

Hello,

The JSF Spec says how a non-Faces request can be handled to generate a Faces response in section 2.1.1.

This works in as much as it generates a viewable page. However, the action URL's generated by the ViewHandler.getActionURL method do not seem to be correct if the FacesServlet is prefix mapped (e.g. as /faces/*).

In this case the action URL contains the mapping to the servlet called as the non-Faces request. This is because Util.getFacesMapping works by looking at the request that was called. It assumes that this was a request to the FacesServlet, although this is not the case here.

I am using JSF 1.2_01-b04. I will try upgrading to the latest version (although I could not see that this has been fixed in the release notes).

Has anyone come across this issue and got a work-around?

[837 byte] By [StevenOa] at [2007-11-27 3:43:48]
# 1

I can say for certain that it's not.

I understand your point here, but I don't think it's right for the implementation

to parse the web.xml for the servlet mapping. For example, what if there is more than one url mapping to a faces servlet? Which one should be used?

What I would recommend is the use of a ServletRequestWrapper that returns the appropriate mapping info that Util.getFacesMapping() checks for. This should give you the result you're looking for.

rlubkea at 2007-7-12 8:47:25 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Well I have implemented a HttpServletRequestWrapper and that sorts the problem out.Just had to override the getServletPath() method.Thanks for your help.
StevenOa at 2007-7-12 8:47:25 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...