Reputation: 7401
I have a Java desktop app (with a Swing GUI) that runs in a LAN environment. Normally, I run it with a bunch of machines, some play the role of servers while others act as clients.
Now, I would like to run the same app on the Internet, where both the server and clients will be hosted on a website, so that visitors of the website will be able to run as the clients and interact with each other.
I wonder what are options are available for such migration? Do I need to re-write everything from scratch using some Java-based web framework? If so, how should I deal with the GUI part? Or do I just host the app as an applet? (somehow I am reluctant to go down the applet route, as it may require additional setup on individual visitor's machine I have no control of and there may exist compatibility issues). Thanks!
Upvotes: 2
Views: 135
Reputation: 416
One option would be to use Vaadin. The programming mindset is quite close to JavaSE Swing. It is a GWT derivative on the client-side, but the logic is really on the server JVM and the framework takes care of the communication (xhr or web sockets).
Upvotes: 2
Reputation: 1441
If your code follows the mvc pattern it should be possible to reuse the model stuff. My favorite java web frameworks are those from spring source. Spring mvc (clean mvc design) or spring roo (more the rails style with code generation etc.). Both integrate well with the dojo framework (ajax / gui stuff).
Upvotes: 1
Reputation: 27727
Google Web Toolkit (GWT) could be usefull for that since it will let you re-use generic Java code and compile it to JavaScript for running in the browser. In my app I am reusing classes in the client that I use in the server. The UI has to be recreated using web widgets though however wysiwyg tools exist for that.
You could also migrate your raw sockets to Websockets if you require bi-directional communication.
Upvotes: 1