ProxyWriter.fileNameGenerator is responsible for mapping a javascript resource into a filename for caching. It will take up to the first 16 characters of the filtered url.
private static String fileNameGenerator(String addr) {
String newName = CommonUtils.replaceText(addr, "/", "");
newName = CommonUtils.replaceText(newName, "http:", "");
newName = CommonUtils.replaceText(newName, "www.", "");
newName = CommonUtils.replaceText(newName, ".", "");
newName = CommonUtils.replaceText(newName, "?", "");
newName = CommonUtils.replaceText(newName, "&", "");
return newName.substring(0, Math.min(16, newName.length())) + ".html";
}
This will cause cache collisions for longer urls. e.g.
http://www.uportal.org/path/to/the/file/javascript.js
http://www.uportal.org/path/to/the/file/javascript2.js
Both will get mapped to uportalorgpathto
This should be refactored into perhaps a file system structure. So that
http://www.uportal.org/path/to/the/file/javascript.js would get mapped to org.jasig.portal.serialize.ProxyWriter.proxy_files_path + /path/to/the/file/javascript.js.