if(((BlockAttributes)attributes).getFetchAttributes() != null) {
require(WidgetScriptModules.BASE_BB_FETCH, protocol, attributes);
// render javascript constructor
FetchAttributes fetchAttrs = ((BlockAttributes)attributes).getFetchAttributes();
buffer.append("fetch: new Widget.BlockFetch({src: '");
buffer.append(fetchAttrs.getSrc() + "'");
// add localization of installed MCS
buffer.append(", pageBase : '/").append(protocol.getMarinerPageContext()
.getVolantisBean().getPageBase()).append("'");
if(fetchAttrs.getTransformation() != null) {
buffer.append(", transformation: '");
MarinerPageContext pageContext = protocol.getMarinerPageContext();
// get MarinerURL to page with xsl
MarinerURL marinerURL = pageContext.getRequestURL(true);
URI path = null;
try {
path = new URI(marinerURL.getExternalForm());
} catch (URISyntaxException e) {
throw new IllegalStateException("URI to xsl transformation template is invalid");
}
URI fullPath = path.resolve(fetchAttrs.getTransformation());
buffer.append(fullPath.toString() + "'");
}
if(fetchAttrs.getService() != null) {
buffer.append(", service: '");
buffer.append(fetchAttrs.getService() + "'");
}
if(fetchAttrs.getWhen() != null) {
buffer.append(", when: '");
buffer.append(fetchAttrs.getWhen() + "'");
}
if(fetchAttrs.getTransformCache() != null) {
buffer.append(", transformCache: '");
buffer.append(fetchAttrs.getTransformCache() + "'");
}
if(fetchAttrs.getTransformCompile() != null) {
buffer.append(", transformCompile: '");
buffer.append(fetchAttrs.getTransformCompile() + "'");
}
buffer.append("})");
delimited = true;
}