1

One of my friend asking me something related to Client Software and Cloud. Java Desktop Swing as Client and Web as Data Resource (Database -1 single hosting). That's the main thing I've heard.

If there's a common java app used as a client how do the app communicate to the data resource (on the web)...?

I answered with "passing database Query", Database Query from Client to Web (Data Resource). But, after I recalled it back, my method is dangerous. What is the safer thing to be done? Is it needed to create another app on the Web used as a bridge (API)?

Need advice on this matter.

gumuruh
  • 2,544
  • 4
  • 33
  • 56

3 Answers3

3

One way to implement this will be to have REST based API at the backend and your swing GUI interacting with that API using HTTP calls. You can use Apache's HTTPClient library for making HTTP calls.

Param
  • 2,420
  • 1
  • 14
  • 10
  • ya @Param, i think i should make this one. The Web Service API, isn't? BUt.... wouldn't dangerous? passing a series of Http Calls.... – gumuruh Jan 19 '12 at 08:35
  • No, REST API is commonly used by many websites. E.g. twitter clients (desktop/mobile applications) interact with Twitter using REST API. However, you will have to add authentication to your web services. OAuth is commonly used to add authentication to REST services. – Param Jan 19 '12 at 11:11
2

Deploy your Swing application via Java Web Start. Running in a sandbox, "the application may only connect to the host on which it resides."—faq.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • hmmm... @trashgod, never tried that one. Is that more shorter time than making our own API for RestFul type of Web Service as mentioned below? – gumuruh Jan 19 '12 at 08:37
  • @gumuruh: JWS is a deployment strategy that complements REST. Note that a `PersistenceService` is available even in a restricted execution environment (sandbox). – trashgod Jan 19 '12 at 10:04
1

If you application runs via Java WebStart, you can simply run a webserver on the cloud and deploy it there like you would on any other web server. The users of course would need to hava a JRE in order to be able to run it.

Another option, if you are looking for a truly thin HTML/JavaScript cloud based delivery, is AjaxSwing. It would run your Swing application on the cloud and convert the UI it at runtime to HTML/JavaScript, making it indistinguishable from any other cloud based software as a service.