使用 javascript 获取快速共享网址 [英] Get quickshare url with javascript
本文介绍了使用 javascript 获取快速共享网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用 JavaScript 共享一个文档并以编程方式获取它的 share_id
.有一个 REST API
可以做到这一点,但我不知道如何从脚本中调用它.
I want to share a document with JavaScript and get its share_id
programatically.
There is a REST API
that can do that but I didn't know how to call it from script.
有什么线索吗?
推荐答案
以下 hack 可以解决问题.(必须从存储库中的类路径执行)
The following hack will do the trick. (edit: Must be executed from the classpath in the repository)
var ctx = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
var qsService = ctx.getBean("QuickShareService");
var sId = document.properties['qshare:sharedId'];
if (!sId) {
sId = qsService.shareContent(document.nodeRef).id;
}
PS:由于 rhino-1.7,它在 5.0.a 上看起来更难看.
PS: It looks even more ugly on 5.0.a due to rhino-1.7.
这篇关于使用 javascript 获取快速共享网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文