Originally posted by Ajit Malleri:
[...] The servlet needs to send this detail to the swing application. Now the problem is how should I send the detail to the swing application? The swing-servlet communication is through sockets.
Why?
Personally, I'd subscribe to the XP mantra of doing the same thing that possibly works. With a servlet in a servlet container, you already have a perfectly fine, lightweight, well-supported network infrastructure. Why not have the servlet -- or a different servlet in the same web-app -- serve up the required information? The Swing application could simply request/poll as required.
I am thinking of sending the hashtable to the swing application where I will de-serialize the information and built it on the client side.
You can do that; have a magic HTTP request (protected using container security if need be) that serves up serialized
Java objects. If you want a more portable and flexible approach you could return an XML file or even use XML-RPC or
SOAP.
But what about the scenario when I have plenty of information to send? It will consume a lot of resources and will be very slow. How should I solve this problem?
That depends on the information. You might be able to just send what's new.
A completely different approach would be to use a SQL database, ranging from a lightweight embedded
hsqldb database through
MySQL to
Oracle. The servlet would stuff its raw information into the database. The Swing application would query this database; I assume it wants to digest the raw results in some way, and digesting large amounts of information is something databases were designed to do.
If firewalls are an issue, you can still tunnel this over HTTP.
- Peter
[ January 17, 2003: Message edited by: Peter den Haan ]