在GWT中调用Native(C ++)代码 [英] Calling Native(C++) Code in GWT

查看:98
本文介绍了在GWT中调用Native(C ++)代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在GWT中开发一个应用程序,它需要在Directshow中调用一个本地C ++代码来执行一些多媒体处理。我猜测我不能使用JNI,因为GWT会将代码转换为javascript.I确实看过类似的帖子论坛(以及关于JSNI的GWT网站),但没有找到一个具体谈论从GWT调用C ++代码的例子(它主要是关于从Javascript调用Java代码)。任何人都可以对此有所了解,或者指导我参加一个教程?首先,要明确区分Client(在浏览器中运行的HTML / Javascript)和服务器组件(Java服务servlet) )。
$ b 如果我正确理解了您的问题陈述,您需要UI为您的代码转换器收集参数,并且代码转换器需要在Windows盒子上运行。

您可以查找任何简单的GWT应用程序,以了解如何在任何容器中为GWT应用程序提供服务(可能暂时为jetty)并处理基本的HTML表单输入。一旦你拥有了服务器上的所有参数,你就需要弄清楚如何将从浏览器发布的这些参数(你的GWT应用程序)从服务servlet(运行在Web服务器中)委托给你的DirectShow应用程序。这一点上它的一个Java应用程序与本地进程问题交谈。

您可以使用各种方式将参数传送到本地directshow应用程序。最简单的解决方案是使用内联的exec方法传递命令参数来启动应用程序。否则,您可以通过TCP套接字与正在运行的本机应用程序通信,或使用JNI集成本机应用程序。这一切都取决于你的建筑设计,你想采取哪种方法。

I am developing an application in GWT which needs to call a native C++ code in Directshow to do some multimedia processing.I am guessing that I cant use JNI because GWT converts code to javascript.I did have a look at similar posts on the forum(and on GWT site about JSNI) but cant find a example that specifically talks about calling C++ code from GWT(its mostly about calling Java code from Javascript).Can anyone throw some light on this or direct me to a tutorial?

解决方案

First of all, have a clear separation of Client (HTML / Javascript running in the browser) and server components (java service servlets).

If I understood your problem statement right, You need the UI to collect parameters for your transcoders and your transcoders need to run on a Windows box.

You can look up any simple GWT application to figure out how to serve a GWT application in any container (perhaps jetty for the time being) and process basic HTML form inputs. Once you have all the parameters on the server, you need to figure out how to delegate these parameters posted from the browser (your GWT application) from the service servlet (running within a web server) to your DirectShow application. This point onwards its a java application talking to a native process problem.

You can use various ways to communicate parameters to your native directshow application. Simplest solution is to initiate the application with the exec method passing command parameters inline. Otherwise you can communicate to a running native application via TCP sockets or integrate the native app using JNI. It all depends on your architectural design, which approach you wish to take.

这篇关于在GWT中调用Native(C ++)代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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