use of org.alfresco.repo.virtual.ref.GetVanillaScriptInputStreamMethod in project alfresco-repository by Alfresco.
the class ApplyTemplateMethod method execute.
@Override
public VirtualFolderDefinition execute(VanillaProtocol vanillaProtocol, Reference reference) throws ProtocolMethodException {
InputStream vanillaIS = reference.execute(new GetVanillaScriptInputStreamMethod(environment));
try {
String vanillaJSON = IOUtils.toString(vanillaIS, StandardCharsets.UTF_8);
VirtualContext context = createVirtualContext(reference);
context.setParameter(VANILLA_JSON_PARAM_NAME, vanillaJSON);
return execute(vanillaProtocol, reference, context);
} catch (IOException e) {
throw new ProtocolMethodException(e);
} finally {
try {
if (vanillaIS != null)
vanillaIS.close();
} catch (IOException ioe) {
logger.warn("Failed to close input stream : " + ioe);
}
}
}
Aggregations