try {
context = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
Request request = context.getRequest();
boolean ssl = request.isSecure();
LinkRewriter rewriter = new OutgoingLinkRewriter(this.manager, getSession(),
getSourceURL(), ssl, false, false);
Map asset2proxyUrl = new HashMap();
setParameter("asset2proxyUrl", asset2proxyUrl);
Document[] resources = getResourceDocuments();
for (int i = 0; i < resources.length; i++) {
String originalUrl = resources[i].getCanonicalWebappURL();
int lastDotIndex = originalUrl.lastIndexOf('.');
String extension = resources[i].getSourceExtension();
String url = originalUrl.substring(0, lastDotIndex) + "." + extension;
String proxyUrl = rewriter.rewrite(url);
asset2proxyUrl.put(resources[i], proxyUrl);
}
setParameter("assets", resources);