aspose file tools*
The moose likes Servlets and the fly likes Non Blocking HttpPost Request / Client-Server communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Non Blocking HttpPost Request / Client-Server communication" Watch "Non Blocking HttpPost Request / Client-Server communication" New topic
Author

Non Blocking HttpPost Request / Client-Server communication

Ken Tokuhamaru
Greenhorn

Joined: Jul 06, 2009
Posts: 6
Hello,

I have a question regarding the parallel processing of Http Post requests. In my architecture (Client-Server), I want to communicate with the server over HTTP Post Request/Repsonse. The communication works fine so far, however I have noticed that requests are being processed one-by-one (not parallel), in the opposite way from what I have known from the general Http Request behavior. Following is the code of Client and Server:

Client - JavaBean



Server - Servlet:



When I make multiple requests with my Client, the Servlet process' the requests one-by-one. I can imagine that by nature the communication (InputStream/OutputStream) is blocking, but shouldn't each request to the Servlet create a new Thread, which handle the Http Post request ? Can someone show me the way how I can implement the code in a non-blocking//parallel way ? I would like to know how Browsers implement such things.

Thank You,

Ken
Ken Tokuhamaru
Greenhorn

Joined: Jul 06, 2009
Posts: 6
Seems like I made a mistake requesting the Http Server. I have sent multiple requests to the server via a Webservice, which I invoked multiple times, this caused the Webservice to block. I have enclosed the requesting code into a Thread, and sent multiple requests via parallel Threads, to which the Servlet responded fine. Mystery solved, the error was on my side.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Non Blocking HttpPost Request / Client-Server communication