Can an Applet that uses JavaScript to communicate with web server be migrated to JWS?
<p>Just sharing some information hoping that it would be useful to the community.</p>

<p>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.</p>

<p>One of the applications we developed required use of Applets for the following reasons</p>

<ol>
<li>Ability to access ports and peripheral devices attached to computing devices</li>
<li>Ability to exchange information with the web application (Through JavaScript)</li>
<li>Noninvolvement of System Administrators for installations and maintenance </li>
<li>Application had to be launched from within the browser</li>
</ol>

<p>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.</p>

<p>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. </p>

<p>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.</p>

<p>This is how we adapted JWS </p>

<ol>
<li><p>User would access the web page that referred JNLP file containing details required to launch JWS application</p></li>
<li><p>The Web application would provide unique identifier to the JWS application via JNLP file</p></li>
<li><p>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</p></li>
<li><p>After reading information from a serial port, the JWS application would perform a HTTP POST and send readings along with UID as a parameter </p></li>
<li><p>Server would save the results and finish the long polling/reverse AJAX call; notifying web application the status of the operation</p></li>
</ol>

<p>Shridhar</p>