How can a desktop application communicate with a web application?

旧街凉风 提交于 2019-12-13 07:26:54

问题


I've got a desktop EXE application and a GWT webapplication running on a Java appserver backend. How can I do things in the desktop app like click buttons which do something in the webapp? We can fire up a browser, but what about further interaction after that? If the user switches back to the desktop app and does something, can we get the browser back on top when we need it to?

They are both connected to the same backend application server, so communication via server could be possible for the other way around (webapp to desktop app).

Update

We are checking out an applet inside the web application: with some permissions set, it can communicate on the local user's network to talk to a wrapper for the existing desktop application. We'll see how that goes in terms of responsiveness.


回答1:


There's probably more alternatives that I will propose, but quick solutions that I see are as follows:

  1. Expose web services/REST/anything that fits well so that your desktop app could exchange information in client-server manner
  2. Use your GWT RPC services from desktop app. I think that should be possible, and quick search revealed this one: Java on Gems



回答2:


You can expose the functionality of your server application through web-services. SOAP or REST are standard. Then you can invoke these services from the desktop client. With Java, these are covered by JAX-WS and JAX-RS. Which have multiple implementations. Metro, Jersey, CXF, RESTEasy.

Technically, you can write browser extensions that can communicate with your desktop app, and in turn modify / interact with the pages, but that would be harder to create and maintain.




回答3:


Direct communication from web application to desktop application is not possible.. you should use a mediator..

And also, you have to use long polling for gwt application to get commands from desktop application.



来源:https://stackoverflow.com/questions/4519741/how-can-a-desktop-application-communicate-with-a-web-application

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