- Display display = Display.getCurrent();
- if (display == null)
- return null;
- CmsView cmsView = (CmsView) display.getData(CmsView.KEY);
- if (cmsView == null)
- return null;
- return cmsView;
+ return UiContext.getData(CmsView.KEY);
+ }
+
+ public static String getDataUrl(Node node, HttpServletRequest request)
+ throws RepositoryException {
+ return request.getRequestURL().append(getDataPath(node).substring(1))
+ .toString();
+ }
+
+ public static String getDataPath(Node node) throws RepositoryException {
+ return new StringBuilder().append(WEBDAV_PUBLIC).append('/')
+ .append(ALIAS_NODE + "/")
+ .append(node.getSession().getWorkspace().getName())
+ .append(node.getPath()).toString();
+ }
+
+ public static String getCanonicalUrl(Node node, HttpServletRequest request)
+ throws RepositoryException {
+ return request.getRequestURL().append('!').append(node.getPath())
+ .toString();