Hello
During configuring JSF on Spring DM I encountered problems with taglibs.
It turn out that not all taglibs from existings JSF components library are registered (from RichFaces for examples).
I started to investigate and found the reason.
Every JSF taglibs are defined at faces-config.xml so first of all, com.sun.faces is looking for faces-config.xml files.
Metod, which do it is com.sun.faces.config.ConfigManager.getConfigDocume nts(ServletContext sc)
As you can see at ConfigManager class, there are several resource providers.
The important for our problem is MetaInfResourceProvider
This provider is looking for files faces-config.xml at META-INF directories.
There is a method of this provider (I use com.springsource.com.sun.faces-1.2.0.09.jar):
URL for bundle resources at Spring DM Server looks like this one for example:Code:public List<URL> getResources(ServletContext context) { SortedMap<String, URL> sortedJarMap = new TreeMap<String, URL>(); //noinspection CollectionWithoutInitialCapacity List<URL> unsortedResourceList = new ArrayList<URL>(); try { for (Enumeration<URL> items = Util.getCurrentLoader(this) .getResources(META_INF_RESOURCES); items.hasMoreElements();) { URL nextElement = items.nextElement(); String jarUrl = nextElement.toString(); String jarName = null; int resourceIndex = jarUrl.indexOf(META_INF_RESOURCES); // If this resource has a faces-config file inside of it // and is within a JAR. Classpath resources not included // within a JAR will not be sorted. if (resourceIndex != -1 && "jar".equals(nextElement.getProtocol())) { // Search backwards for the previous occurrence of File.SEPARATOR int sepIndex = resourceIndex - 2; char sep = ' '; while (0 < sepIndex) { sep = jarUrl.charAt(sepIndex); if ('/' == sep) { break; } sepIndex--; } if ('/' == sep) { jarName = jarUrl.substring(sepIndex + 1, resourceIndex - 2); } } if (null != jarName) { sortedJarMap.put(jarName, nextElement); } else { unsortedResourceList.add(0, nextElement); } } } catch (IOException e) { throw new FacesException(e); } // Load the sorted resources first: List<URL> result = new ArrayList<URL>(sortedJarMap.size() + unsortedResourceList.size()); for (Map.Entry<String, URL> entry : sortedJarMap.entrySet()) { result.add(entry.getValue()); } // Then load the unsorted resources result.addAll(unsortedResourceList); return result; }
jar:file:/C:/Env/springsource/dm-server-2.0.0.RELEASE/work/osgi/configuration/org.eclipse.osgi/bundles/38/data/store/org.eclipse.osgi/bundles/71/1/bundlefile!/META-INF/faces-config.xml
So, this method find such resources, extract jar name and then put found URL to the HashMap under jar name key. The problem is that name of jar of our URL for differ bundles is the same: bundlefile
As you can guess, every resources are put into the HashMap under the same key: bundlefile. This causes that only one face-config.xml is registered even if you have many of component libraries.
The only solution of this problem is to rewrite method getResource of class MetaInfResourceProvider. It should be done at OSGI bundle com.springsource.com.sun.faces.jar. Bundles repository should offers libraries adjusted to OSGI enviroment.


