public static String getRealNodePath(Node node) throws Exception { if (node.isNodeType("nt:frozenNode")) { Node realNode = getRealNode(node); return Text.escape(realNode.getPath(), '%', true) + "?version=" + node.getParent().getName(); } return Text.escape(node.getPath(), '%', true); }
public static String getWebdavURL(Node node, boolean withTimeParam, boolean isGetRealNodePath) throws Exception { NodeLocation location = NodeLocation.getNodeLocationByNode(getRealNode(node)); String repository = location.getRepository(); String workspace = location.getWorkspace(); String currentProtal = PortalContainer.getCurrentRestContextName(); String portalName = PortalContainer.getCurrentPortalContainerName(); String originalNodePath = isGetRealNodePath ? getRealNodePath(node) : Text.escape(node.getPath(), '%', true); StringBuffer imagePath = new StringBuffer(); imagePath .append("/") .append(portalName) .append("/") .append(currentProtal) .append("/jcr/") .append(repository) .append("/") .append(workspace) .append(originalNodePath); if (withTimeParam) { if (imagePath.indexOf("?") > 0) { imagePath.append("&time="); } else { imagePath.append("?time="); } imagePath.append(System.currentTimeMillis()); } return imagePath.toString(); }