从Alfresco中的Java Webscript调用js Webscript [英] Call js webscript from Java webscript in Alfresco

查看:117
本文介绍了从Alfresco中的Java Webscript调用js Webscript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题。我需要从Java webscript执行js webscript。我知道,该怎么做:

I have a problem. I need execute js webscript from Java webscript. I know, how do it:

req.getRuntime().getContainer().getRegistry().getWebScript("com/home/testJs/testJs.get").execute(req, res)

,但如何构造新的WebScriptRequest对象?我需要重写请求路径。对我来说真的是一个问题。
谢谢。

, but how to construct the new WebScriptRequest object? I need do it for rewrite request path. It's a really problem for me. Thank you.

推荐答案

通常,您应该使用 WebScriptRequestURLImpl 。没有任何其他细节,很难更进一步。

In general, you should use WebScriptRequestURLImpl. Without any other detail, it's hard go any deeper.

也就是说,一般来说,对自己进行另一个HTTP调用来解决问题是一个坏主意,基本上是不良模块化或缺乏代码重用的指示。

That said, it's in general a bad idea to go through yet another HTTP call to yourself to fix your problem, it's basically an indication of poor modularization or lack of code reuse.

我宁愿将JS和Java Web脚本流程中常见的那段代码转换为操作,您可以在两个地方调用它而不必重新包装输入参数,或者更糟的是将它们发送出去通过HTTP。

I'd rather move the piece of code that's common in both the JS and Java web scripts flows to be an Action, which you could invoke from both places without having to repackage the input parameters, or worse send them via HTTP.

这篇关于从Alfresco中的Java Webscript调用js Webscript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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