[英]Communication between browser and java component
I am currently working on a point of sale application. 我目前正在研究销售点应用程序。 we have a existing system based on java which uses javapos to integrate with the devices (such as receipt printer, cash drawer , MSR etc).
我们有一个基于java的现有系统,该系统使用javapos与设备集成(例如收据打印机,现金抽屉,MSR等)。 now we are trying to port the java based thick client to service enable , so it is set to become a web app backed by html5 and spring webservice
现在,我们正在尝试将基于Java的胖客户端移植到service enable,因此它将设置为由html5和spring webservice支持的Web应用程序
my problem is to integrate the devices to the web ie browser so that the cashier can access the point of sale application from the browser . 我的问题是将设备集成到网络(即浏览器)中,以便收银员可以从浏览器访问销售点应用程序。
how do i integrate the devices to the web app now. 我现在如何将设备集成到Web应用程序。 one option i have is deploying a java component in the register and make it communicate it to browser via websocket.
我有一个选择是在寄存器中部署一个Java组件,并使其通过websocket与浏览器通信。
browser<-> websocket <-> java device component in local system 浏览器<-> websocket <->本地系统中的Java设备组件
Is there any better way to do this? 有什么更好的方法吗? i need the technology which enable me to do the same.
我需要使我能够做到的技术。
i have considered the applet as well but the problem is the local java component is kinda huge and it will have different device drivers for each system. 我也考虑过该applet,但是问题是本地Java组件相当庞大,并且每个系统都有不同的设备驱动程序。
JavaFX offers a pretty decent web browser component, that allows easy communication between the Javascript code that runs in the page and the Java code outside. JavaFX提供了一个相当不错的Web浏览器组件,该组件使页面中运行的Javascript代码与外部的Java代码之间的通信变得容易。 You could port your application so that:
您可以移植您的应用程序,以便:
A "Hybrid" JavaFX/HTML application example is iBreed (it is a framework that you can use actually). iBreed是“混合” JavaFX / HTML应用程序示例(它是您可以实际使用的框架)。
I think you can make it work, but you will need one more piece of software. 我认为您可以使其正常运行,但是您将需要另外一个软件。
I think, this is exactly the same approach as you mentioned with websockets. 我认为,这与您在websockets中提到的方法完全相同。 (Ony for older browser).
(仅适用于较旧的浏览器)。
Take a look at atmosphere. 看一下气氛。 This may help you to get the websocket stuff done: https://github.com/Atmosphere/atmosphere
这可以帮助您完成websocket的工作: https : //github.com/Atmosphere/atmosphere
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.