use of com.zimbra.cs.dav.resource.UrlNamespace.UrlComponents in project zm-mailbox by Zimbra.
the class DavContext method getInternalDestinationUrl.
private String getInternalDestinationUrl(String destinationUrl) throws ServiceException, DavException {
UrlComponents uc = UrlNamespace.parseUrl(destinationUrl);
Account targetAcct = Provisioning.getInstance().getAccountByName(uc.user);
if (targetAcct == null)
return destinationUrl;
ZMailbox zmbx = getZMailbox(targetAcct);
ItemId targetRoot = new ItemId("", Mailbox.ID_FOLDER_USER_ROOT);
Pair<ZFolder, String> match = zmbx.getFolderByPathLongestMatch(targetRoot.toString(), uc.path);
ZFolder targetFolder = match.getFirst();
if (targetFolder instanceof ZMountpoint) {
ZMountpoint zmp = (ZMountpoint) targetFolder;
ItemId target = new ItemId(zmp.getOwnerId(), Integer.parseInt(zmp.getRemoteId()));
Account acct = Provisioning.getInstance().getAccountById(zmp.getOwnerId());
ZMailbox targetZmbx = getZMailbox(acct);
ZFolder f = targetZmbx.getFolderById(target.toString());
String extraPath = match.getSecond();
destinationUrl = DavServlet.DAV_PATH + "/" + acct.getName() + f.getPath() + ((extraPath != null) ? "/" + extraPath : "");
}
return destinationUrl;
}
Aggregations