File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes sending multiple mobile client requests to servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "sending multiple mobile client requests to servlet?" Watch "sending multiple mobile client requests to servlet?" New topic

sending multiple mobile client requests to servlet?

sanjay khuntia

Joined: Oct 01, 2008
Posts: 1
Hi all,
I am new to this forum and I am facing a problem. It is like- I have written some MIDlet application for Mobiles which sends HTTP post data to a servlet running on some address and the servlet takes the request data, processes them and gives back results as response. The data comes ok at device end if only one device sends request.But for multiple requests from multiple devices sent simultaneouly to the same servlet at the same location(URL), the results at each device end sometimes comes different and sometimes the results are not shown to the proper device which sent a differnt request. say, three mobile clients send 3 different requests, then at each device end the result should be different..but in my case, two showing same results and one showing different results...

How come the servlet handle each clients request separately so that each device gets the appropriate result according to its query..Is there any Multi threading can be done at servlet side so that it will handle each device request separately..

please keep in mind..i m new to servlet and Java stuff..please guide me how can oercome this situation so that the servlet can handle multiple client request separately for processing.

Or is there any code chnge should be done at my mobile device side to handle response...

Thanks and regards,
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

Sounds like you've run across the old thread safe servlets problem . This Article will help you out with some tips and tricks. I also recommend googling for thread safe servlets to find more

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
I agree. Here's the link:
subject: sending multiple mobile client requests to servlet?
jQuery in Action, 3rd edition