Can an Applet that uses JavaScript to communicate with web server be migrated to JWS?
Asked Answered
L

0

3

Just sharing some information hoping that it would be useful to the community.

Usability of Applets have gone down since various browsers stopped supporting plugins. Google has decided to discontinue support for NPAPI plugin, EDGE does not support plugins, Firefox is also discouraging use of plugins, and Mozilla may follow the suite.

One of the applications we developed required use of Applets for the following reasons

  1. Ability to access ports and peripheral devices attached to computing devices
  2. Ability to exchange information with the web application (Through JavaScript)
  3. Noninvolvement of System Administrators for installations and maintenance
  4. Application had to be launched from within the browser

The situation described earlier made us consider Java Web Start (JWS) technology as a potential alternative to Applet. JWS however came up with its own set of challenges due to its inability to communicate with the web application.

The solution (Applet) we had in place, would get a unique identifier from the web application; read data over serial ports; and submit the data to the web server along with previously received unique identifier. Rewriting a standalone application was not an option since the user community was as large as a typical B2C user community. Educating such a large community on using the application differently involved a lot of efforts and support staff. Developing a new application would also have involved significant efforts in terms of the product life cycle.

Adapting JWS had an advantage of reusing the code that was developed for Applet. However option to exchange information between Applet and Web Application with the help of Applet-JavaScript bridge was not available with JWS.

This is how we adapted JWS

  1. User would access the web page that referred JNLP file containing details required to launch JWS application

  2. The Web application would provide unique identifier to the JWS application via JNLP file

  3. At this time the web application would start long polling/reverse AJAX. This was necessary since we had to notify success/failure results to the end user through web application

  4. After reading information from a serial port, the JWS application would perform a HTTP POST and send readings along with UID as a parameter

  5. Server would save the results and finish the long polling/reverse AJAX call; notifying web application the status of the operation

Shridhar

Ludwigg answered 26/9, 2016 at 11:13 Comment(2)
"Just sharing some information hoping that it would be useful to the community." This is a Q&A site, rather than a place to 'share information' as such. Having said that, you might rework this into a question like - "Can an applet that requires close interaction with a web.app be deployed using JWS, and if so, how?" and then move what's above into an answer below. (Yes, we can answer our own questions, and SO actually awards a badge for doing exactly that.)Exultation
Got it! Thanks. Will take care from next time and will update this section as well.Ludwigg

© 2022 - 2024 — McMap. All rights reserved.