Externalizer not externalizing
We've created some html email templates in CQ5. We've got a web service that grabs the appropriate one and hands the raw html off to another service that actually sends the thing. The html has static assets in the DAM presented via a cq.adaptiveimage component.
Of course, this doesn't work for us. All of the assets are referenced by relative URL, which is great if the page is being served by AEM, but not so great for an email template.
I've attempted to implement a new component called "External Adaptive Image". I've just copied the adaptiveimage component from libs/foundation/components, and altered the jsp like this:
<%@include file="/libs/foundation/global.jsp"%><% %><%@page session="false" import="com.day.cq.commons.Externalizer, // Redacted Adobe-supplied includes org.apache.sling.api.resource.ResourceResolver"%><% %><% // This is Adobe-supplied, but it's just to give you an idea where I // inserted my code String fileReference = properties.get("fileReference", ""); if (fileReference.length() != 0 || resource.getChild("file") != null) { // Redacted Adobe-supplied code // My new things ResourceResolver rr = slingRequest.getResourceResolver(); Externalizer exernalizer = rr.adaptTo(Externalizer.class); %>After this, I just use the externalizer's absoluteLink method to augment the existing data-src divs:
<div data-src='<%= exernalizer.absoluteLink(slingRequest, "http", path + ".img.320.low." + extension + suffix) %>' data-media="(min-width: 1px)"></div>
This just results in more relative URLs though. They look like this:
<div data-src="/content/a/b/c/d/en/welcome/jcr:content/par/adaptiveimage_extern.img.320.low.png/1401316368975.png" data-media="(min-width: 1px)"></div>
I'm expecting something more like:
<div data-src="http://my.thing.com/content/a/b/c/d/en/welcome/jcr:content/par/adaptiveimage_extern.img.320.low.png/1401316368975.png" data-media="(min-width: 1px)"></div>
Anyone have experience using the Externalizer? Am I doing something wrong?