Get quickshare url with javascript

跟風遠走 提交于 2019-12-25 07:30:31

问题


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.

Any clues?


回答1:


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: It looks even more ugly on 5.0.a due to rhino-1.7.



来源:https://stackoverflow.com/questions/24653926/get-quickshare-url-with-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!