使用JavaScript获取QuickShare网址 [英] Get quickshare url with javascript

查看:85
本文介绍了使用JavaScript获取QuickShare网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用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.

有任何线索吗?

推荐答案

以下技巧可以解决问题。 (编辑:必须从存储库中的类路径执行)

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获取QuickShare网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆