File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Urgent Help Needed. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Urgent Help Needed." Watch "Urgent Help Needed." New topic
Author

Urgent Help Needed.

Ajit Malleri
Greenhorn

Joined: Feb 10, 2002
Posts: 27
Hi all,
The following is a brief description of what I have to implement:
The idea of this application is to track the users on the site and send the details to the swing application. There's a piece of javascript code in the webpage which sends the details to the servlet in certain time interval. In the servlet the details are stored in a hashtable. Details are stored in a bean which is in turn stored inside the hashtable. The detail also include the total time on page. 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. 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. 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?
Thanks,
Ajit
gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
there is a specific file for IIS, check that out.
That is the one that will solve your problem in an easy by M$ way.
But for that, you will need to have a strong logic for session tracking/profiling the user.
I have done that for a desktop application, I will think of a way for the Web and let you know.
Regds
Lupo


"In the country of the blind, the one eyed man is the King"
Gautham Kasinath CV at : http://www.geocities.com/gkasinath
Ajit Malleri
Greenhorn

Joined: Feb 10, 2002
Posts: 27
Thanks buddy .. will wait for your answer.
gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
I m sorry Ajit, I havent been able to think in those lines for a wile now. I guess I will spend my weekend on the issue.
Lupo
Karthik Banda
Greenhorn

Joined: Oct 24, 2002
Posts: 9
Hello Ajith,
Its a wonderful problem most of we guys are facing. What i suggest is go with Asynchronous messaging using JMS. Your servlet will publish the details to a destination and from there ur swing application will subscribe it and gets the details as a message. I cant excatly spare some time...other wise i would have given u atleast a skeleton..But dont forget that there needed a session locatior or identifier whose information it is and i suggest u go with using StingBuffer or String with a few Delimiters written as a message from the servlet.
Last which company are u working for and where?
What sort of product it is....
mail me in person at karthik78in@yahoo.com
Regards,
karthik


Sun Certified Java Programmer<br />Sun Certified Web Component Developer <br />Sun Certified Business Component Developer<br />BEA Certified Weblogic Server Specialist<br /> <br />Never Stop Questioning......
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
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 embeddedhsqldb 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 ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Urgent Help Needed.
 
Similar Threads
Multiple response for a request
need help regarding applet-servlet communication scenario
some java interview Questions
How to load a Java application to Oracle DB
Stored Procedures and arrays