This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet Collaboration, and dispatching request 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 » Servlets
Bookmark "Servlet Collaboration, and dispatching request" Watch "Servlet Collaboration, and dispatching request" New topic

Servlet Collaboration, and dispatching request

arif azim

Joined: Mar 26, 2002
Posts: 7
I need to create a network of web servers for distributed applications. I want users to acess servlets at any server and the servlet at that server then passes information to a servlet at a central server. The central server then invokes another servlet at the original/other servers. I think this can be accomplished by servlet chaining but it seems there is some issue with containers supporting servlet chaining. Please suggest what protocol can be used to invokes servlets through servlets especially across web servers. :roll: :roll:
Karl Moss

Joined: Feb 08, 2002
Posts: 18
If you are on the same server you would use a RequestDispatcher to dispatch a request to another servlet. If you want to work with a servlet running on a different server then you will need to open a URLConnection and issue an HTTP request to that server and then read the response. Depending upon what you need to do you can work with either plain text, binary data, or serialized objects. If you need an example, pick up the Applet to Servlet Communication Web Application from There are a couple of simple examples included where a Java application calls a servlet; you could just as easily use this code from within a servlet to call another servlet.
Hope this helps.

Karl Moss,<br />Author of <a href="" target="_blank" rel="nofollow">Java Servlets Developer's Guide</a> <br /><a href="" target="_blank" rel="nofollow"></a> the Companion site.
arif azim

Joined: Mar 26, 2002
Posts: 7
Thank you sir!........
I agree. Here's the link:
subject: Servlet Collaboration, and dispatching request
Similar Threads
Deploying the application on to server
servlet load issue
servlet communication between two JVMs
servlet unloading
Tomcat Vs. Other web servers