简体   繁体   English

有没有办法使用Javascript将html与RCP(E4)应用程序接口?

[英]Is there any way to interface html with RCP(E4) application using Javascript?

I have html application with javascript api and I want to communicate and control RCP application via this javascript. 我有带有javascript api的html应用程序,我想通过此javascript进行通信和控制RCP应用程序。 What is the best approach to deal with such case. 处理这种情况的最佳方法是什么?

HTML -> Javascript -> .... -> RCP (E4) application HTML-> Javascript-> ....-> RCP(E4)应用程序

More details added 添加了更多详细信息

Here I have an RCP calculator application. 在这里,我有一个RCP计算器应用程序。 Where User Interface and the Logic (Background function) is implemented. 实现用户界面和逻辑(背景功能)的位置。 Now the usecase is that user want to have Logic(background function) to be exposed to outside so that the HTML can be use javascript to make call to the logic (Background function). 现在,用例是用户希望将Logic(后台功能)暴露给外部,以便HTML可以使用JavaScript调用逻辑(Background函数)。 One problem is that the RCP application is already created and I dont want too much change to the RCP application. 一个问题是RCP应用程序已经创建,我不想对RCP应用程序进行太多更改。 Rather just expose the functionality to be called from javascript. 而是公开要从javascript调用的功能。

One option I figured out is that I can have 我想出的一个选择是我可以拥有

HTML >> Javascript >> webserive call <<->> webservice >> RCP application. HTML >> Javascript >> webserive调用<<->> webservice >> RCP应用程序。

Finally I resolved the problem with following approach: 最后,我通过以下方法解决了该问题:

HTML - Javascript <===> Java server (with Jetty/Jackson) HTML-Javascript <===> Java服务器(带有Jetty / Jackson)

Client side: 客户端:

  1. I made JQuery (ajax) call from the javascript to localhost:port 我从JavaScript对localhost:port进行了JQuery(ajax)调用
  2. Javascript objects converted to JSON before making ajax calls. 在进行ajax调用之前,Javascript对象已转换为JSON。 (If you need dynamic data from server while using GET you can turn on the cache off). (如果在使用GET时需要来自服务器的动态数据,则可以关闭缓存)。

Server side: listening to the port. 服务器端:监听端口。

  1. I used Jetty (servlet embedded within the RCP application). 我使用了Jetty(RCP应用程序中嵌入的servlet)。 Hence no apache configuration required. 因此,不需要apache配置。
  2. I used jackson (Jax-rs) to convert the JSON objects to java object and did the needed processing in RCP application. 我使用杰克逊(Jax-rs)将JSON对象转换为Java对象,并在RCP应用程序中进行了所需的处理。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用浏览器以任何方式获取PC硬件ID(ee javascript) - How to get PC hardware IDs using any way using browser (e.e. javascript) 有没有办法使用 JavaScript 在其默认应用程序中打开文件? - Is there any way to open file in its default application using JavaScript? 有没有办法使用 javascript 自动填充 html 输入 - Is there any way to fill the html inputs automatically using javascript 有什么方法可以使用 HTML 或 JavaScript 设置用户代理? - Is there any way that I can set a user agent by using HTML or JavaScript? 有没有办法知道是否使用HTML和javascript在用户系统上安装了Outlook - Is there any way to know if outlook is installed on users system, using HTML & javascript 有没有办法使用 HTML/JavaScript 播放.flv 文件? - Is there any way to play .flv files using HTML/JavaScript? 有没有办法使用Java脚本列出文件夹中存在的所有文件,而不使用任何HTML标记? - Is there any way to List all the files present in a folder using Javascript without using any HTML tags? 有没有办法使用Javascript或Jquery从浏览器检测任何已安装的应用程序? - Is there any way to detect any installed application from browser using Javascript or Jquery? 有什么方法可以使用HTML / JavaScript和Flash构建Desktop AIR应用程序并从Flash发布它? - is there any way to use HTML/JavaScript and Flash to build an Desktop AIR application and publish it from flash? 有什么方法可以使用本地 web 页面作为接口创建应用程序? - Any way to create an application with the local web page as an interface?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM