Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
4.1
-
None
-
Tapestry 4.1 head 21/7/06
JBoss 4.0.4 GA
Description
Dojo uses relative paths to load modules. e.g. dojo/../tapestry/form.
When these resources are stored within a jar, the Asset service cannot resolve them. I think it would work if they were part of the web resources (since that may use a file resolver) but the classpath resolver does not find them
The AssetService needs to convert the supplied path to a cannonical form (no back references) before it tries to load the resource.
I made a quick modification to the AssertService.translateCssPath method which accomplishes this.
String translateCssPath(String path)
{
if (path == null) return null;
// Remove back references in path.
if( path.indexOf("/../") >= 0 ) {
int start = path.indexOf("/../");
while( start > 0 )
}
// don't parse out actual css files
if (path.endsWith(".css")) return path;
int index = path.lastIndexOf(".css");
if (index <= -1) return path;
// now need to parse out whatever css file was referenced to get the real path
int pathEnd = path.lastIndexOf("/", index);
if (pathEnd <= -1) return path;
return path.substring(0, pathEnd + 1) + path.substring(index + 4, path.length());
}
That passes these tests
public void testRelativePaths()