02-02-2010 12:46 PM
02-02-2010 12:51 PM
public String getWebdavUrl()
{
try
{
List<FileInfo> paths = this.services.getFileFolderService().getNamePath(null, getNodeRef());
// build up the webdav url
StringBuilder path = new StringBuilder(128);
path.append("/webdav");
// build up the path skipping the first path as it is the root folder
for (int i=1; i<paths.size(); i++)
{
path.append("/")
.append(URLEncoder.encode(paths.get(i).getName()));
}
return path.toString();
}
catch (FileNotFoundException nodeErr)
{
// cannot build path if file no longer exists
return "";
}
}
02-02-2010 01:09 PM
this.services.getFileFolderService().getNamePath(null, getNodeRef());
This is how it's done in org.alfresco.repo.jscript.ScriptNode:public String getWebdavUrl()
{
try
{
List<FileInfo> paths = this.services.getFileFolderService().getNamePath(null, getNodeRef());
// build up the webdav url
StringBuilder path = new StringBuilder(128);
path.append("/webdav");
// build up the path skipping the first path as it is the root folder
for (int i=1; i<paths.size(); i++)
{
path.append("/")
.append(URLEncoder.encode(paths.get(i).getName()));
}
return path.toString();
}
catch (FileNotFoundException nodeErr)
{
// cannot build path if file no longer exists
return "";
}
}
Thanks,
Mike
02-03-2010 05:05 AM
<property name="fileFolderService" ref="FileFolderService"/>
public void setFileFolderService(FileFolderService fileFolderService)
{
this.fileFolderService = fileFolderService;
}
02-03-2010 07:20 AM
02-09-2010 03:57 AM
public String getWebdavUrl()
{
Node node = getLinkResolvedNode();
return Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.WEBDAV);
}
public String getBookmarkUrl()
{
return Utils.generateURL(FacesContext.getCurrentInstance(), getNode(), URLMode.SHOW_DETAILS);
}
02-09-2010 01:41 PM
public String getWebdavUrl( NodeRef nodeRef )
{
Node node = new Node( nodeRef );
return Utils.generateURL( FacesContext.getCurrentInstance(), node, URLMode.WEBDAV );
}
Have a common situation here,
I found this on org.alfresco.web.beans.BaseDetailsBean ( bean that backs up the space / content detail page, where the webdav link is shown)
public String getWebdavUrl()
{
Node node = getLinkResolvedNode();
return Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.WEBDAV);
}
public String getBookmarkUrl()
{
return Utils.generateURL(FacesContext.getCurrentInstance(), getNode(), URLMode.SHOW_DETAILS);
}
Utils class and URLMode enum is at org.alfresco.web.ui.common.Utils and org.alfresco.web.ui.common.Utils.URLMode respectively
using that utility method, you should be able to get complete webdav url to your node.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.