webtier@glassfish.java.net

Prefix map FacesServlet to /*

From: <webtier_at_javadesktop.org>
Date: Mon, 31 Aug 2009 09:44:29 PDT

If the FacesServlet is prefix mapped to the application's root and configuring javax.faces.FACELETS_VIEW_MAPPINGS=/* resource paths are incorrectly rendered with prefix "/*/javax.faces.resource/[...]".

Digging a little into the problem, it turns out fixing involves a bit work, because the logic for prefix and extension mapping is duplicated across the source code several times.

com.sun.faces.util.Util.getMappingForRequest()
returns "/*", if the FacesServlet is mapped to the application's root path, otherwise only the path without wildcard is returned. Fixing this problem causing Util.isPrefixMapped() to throw an IndexOutOfBoundsException, because it does not check against empty strings.

I guess the best solution would consist of a brief refacturing, grouping some of Util's static methods like

class FacesMapper {
  private String mapping;
  boolean isPrefixMapped() {...}
  String createFacesUri(String resource) {...}
}


br, Sven
[Message sent by forum member 'tzwoenn' (tzwoenn_at_gmx.de)]

http://forums.java.net/jive/thread.jspa?messageID=362450