如何写入指向Alfresco共享文件夹的链接?(在场地内)
我想创建一个指向Alfresco共享中特定文件夹的HTTP链接 Alfresco Share以相当复杂的方式对路径进行编码:如何写入指向Alfresco共享文件夹的链接?(在场地内),alfresco,alfresco-share,Alfresco,Alfresco Share,我想创建一个指向Alfresco共享中特定文件夹的HTTP链接 Alfresco Share以相当复杂的方式对路径进行编码: thesite http://server/share/page/site/thesite/documentlibrary thesite/documentLibrary/somefolder/anotherfolder http://server/share/page/site/thesite/documentlibrary#filter=path|%2Fsomefo
thesite
http://server/share/page/site/thesite/documentlibrary
thesite/documentLibrary/somefolder/anotherfolder
http://server/share/page/site/thesite/documentlibrary#filter=path|%2Fsomefolder%2Fanotherfolder
thesite/documentLibrary/éß和ệ
http://server/share/page/site/s1/documentlibrary#filter=path|%2F%25E9%25DF%25u548C%25u1EC7
thesite/documentLibrary/a#bc/éß和ệ
http://server/share/page/site/thesite/documentlibrary#filter=path%7C%2Fa%2523bc%2F%25E9%25DF%25u548C%25u1EC7%7C
我怀疑这是一个双URL编码,但斜杠除外,斜杠只进行一次URL编码。但我不是100%肯定
是否有进行这种编码的C#库?我找不到库,因此我编写了以下代码:
if (path.Contains("documentLibrary"))
{
int firstSlashPosition = path.IndexOf("/");
string siteName = path.Substring(0, firstSlashPosition);
string pathWithinSite = path.Substring(firstSlashPosition + "/documentLibrary".Length);
string escapedPathWithinSite = HttpUtility.UrlEncode(pathWithinSite);
string reescapedPathWithinSite = HttpUtility.UrlEncode(escapedPathWithinSite);
string sharePath = reescapedPathWithinSite.Replace("%252f", "%2F");
return "http://server/share/page/site/" + siteName + "/documentlibrary#filter=path|" + sharePath;
}
else
{
// Site name only.
return "http://server/share/page/site/" + path + "/documentlibrary";
}
任何更正或更好的答案将不胜感激 我找不到库,所以我编写了以下代码:
if (path.Contains("documentLibrary"))
{
int firstSlashPosition = path.IndexOf("/");
string siteName = path.Substring(0, firstSlashPosition);
string pathWithinSite = path.Substring(firstSlashPosition + "/documentLibrary".Length);
string escapedPathWithinSite = HttpUtility.UrlEncode(pathWithinSite);
string reescapedPathWithinSite = HttpUtility.UrlEncode(escapedPathWithinSite);
string sharePath = reescapedPathWithinSite.Replace("%252f", "%2F");
return "http://server/share/page/site/" + siteName + "/documentlibrary#filter=path|" + sharePath;
}
else
{
// Site name only.
return "http://server/share/page/site/" + path + "/documentlibrary";
}
任何更正或更好的答案将不胜感激 检查
org.alfresco.repo.web.scripts.site.SiteShareViewUrlGet
以获取实现。它不是很优雅,但看起来很完整,可能是你自己课程的一个很好的起点
这确实应该有一个帮助类,但可能我遗漏了一些东西。检查
org.alfresco.repo.web.scripts.site.SiteShareViewUrlGet
,了解实现。它不是很优雅,但看起来很完整,可能是你自己课程的一个很好的起点
确实应该有一个用于此的帮助器类,但可能我遗漏了一些内容。您可能会发现使用遗留的
?path=
参数创建文档库文件夹URL更容易
使用示例路径/Sample Content/∞⊕⊗¤☺☹★☆★☆★代码>而不是构建表单的URL
http://alfresco.example/share/page/site/mike/documentlibrary#filter=path%7C%2FSample%2520Content%2F%25u221E%25u2295%25u2297%25A4%25u263A%25u2639%25u2605%25u2606%25u2605%25u2606%25u2605%7C&page=1
您可以生成一个
https://alfresco.example/share/page/site/mike/documentlibrary?path=/Sample%20Content/%E2%88%9E%E2%8A%95%E2%8A%97%C2%A4%E2%98%BA%E2%98%B9%E2%98%85%E2%98%86%E2%98%85%E2%98%86%E2%98%85
因此,使用C#可以在路径上使用Uri.EscapeUriString()
,并使用?path=
将其附加到基本文档库URL
您可以在中查看路径参数的解释方式。您可能会发现使用传统的?path=
参数创建文档库文件夹URL更容易
使用示例路径/Sample Content/∞⊕⊗¤☺☹★☆★☆★代码>而不是构建表单的URL
http://alfresco.example/share/page/site/mike/documentlibrary#filter=path%7C%2FSample%2520Content%2F%25u221E%25u2295%25u2297%25A4%25u263A%25u2639%25u2605%25u2606%25u2605%25u2606%25u2605%7C&page=1
您可以生成一个
https://alfresco.example/share/page/site/mike/documentlibrary?path=/Sample%20Content/%E2%88%9E%E2%8A%95%E2%8A%97%C2%A4%E2%98%BA%E2%98%B9%E2%98%85%E2%98%86%E2%98%85%E2%98%86%E2%98%85
因此,使用C#可以在路径上使用Uri.EscapeUriString()
,并使用?path=
将其附加到基本文档库URL
您可以在中看到path参数是如何解释的,该类是Alfresco在需要查找给定页面的共享URL(例如用于放入电子邮件)时使用的,因此它应该相当完整。它以/api/sites/shareUrl?nodeRef={nodeRef}
的形式提供,因此您可以从Repo或ShareYes调用它。确切地说,它是一个webscript-我当然不想在某些Java代码中调用friggin webscript来生成n个URL,但当然要使用Java方法调用。该类没有合适的API。您可以从Java调用webscript,它只是另一个bean!关于调用Alfresco来获取URL的想法:我的客户机程序需要在网络是一种昂贵资源的环境中工作,因此我宁愿复制代码来完成我这边的所有工作,而不调用Alfresco服务器。因此,我宁愿使用Michael建议的类的源代码。当Alfresco需要查找给定页面的共享URL(例如用于放入电子邮件)时,该类就是Alfresco自己使用的,因此它应该相当完整。它以/api/sites/shareUrl?nodeRef={nodeRef}
的形式提供,因此您可以从Repo或ShareYes调用它。确切地说,它是一个webscript-我当然不想在某些Java代码中调用friggin webscript来生成n个URL,但当然要使用Java方法调用。该类没有合适的API。您可以从Java调用webscript,它只是另一个bean!关于调用Alfresco来获取URL的想法:我的客户机程序需要在网络是一种昂贵资源的环境中工作,因此我宁愿复制代码来完成我这边的所有工作,而不调用Alfresco服务器。所以我宁愿使用Michael建议的类的源代码。非常酷!它是否适用于所有最新的露天版本?如果它是遗产,我想它可能很快就会被丢弃,或者有特别的理由相信它会保留一段时间吗?谢谢据我所知,虽然我在共享团队中不再活跃,但没有计划删除它。我会确保爱考团队意识到这是一个积极使用的功能。非常酷!它是否适用于所有最新的露天版本?如果它是遗产,我想它可能很快就会被丢弃,或者有特别的理由相信它会保留一段时间吗?谢谢据我所知,虽然我在共享团队中不再活跃,但没有计划删除它。我会确保爱考团队意识到这是一项正在积极使用的功能。