String runtimeName = getRuntimeName(resource, true);
ContentCapability ccap = (ContentCapability) resource.getCapabilities(ContentNamespace.CONTENT_NAMESPACE).get(0);
URL contentURL = ccap.getContentURL();
if (contentURL == null || !contentURL.toExternalForm().startsWith("file:")) {
ResourceContent content = getFirstRelevantResourceContent(resource);
tempfile = new File(catalinaTemp, runtimeName);
IOUtils.copyStream(content.getContent(), new FileOutputStream(tempfile));
contentURL = tempfile.toURI().toURL();
}
// Get contextPath, username, password
final String contextPath = getContextPath(resource);