简体   繁体   中英

How to publish a web service from within a Java Desktop Application

What I'm trying to do is write a Selenium Webdriver Recorder that will work with any supported browser without needing a browser plugin. I need to be able to communicate back to my Java Desktop Application the actions performed in the browser, however, as I cannot capture browser events via Webdriver I cannot rely on just returning the info via javaScriptExecutor. Therefore I'm looking at trying to host a Java Web Service within my application and preferably only have it listening during recording.

How can I implement an adhoc Web Service like this?

You could use a embedded jetty server that handles websocket request from the browser. For example: http://www.eclipse.org/jetty/documentation/9.3.0.v20150612/jetty-websocket-server-api.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM