This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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:
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 http://www.servletguru.com/downloads.htm. 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="http://www.amazon.com/exec/obidos/ASIN/007222262X/ref=ase_electricporkchop" target="_blank" rel="nofollow">Java Servlets Developer's Guide</a> <br /><a href="http://www.servletguru.com" target="_blank" rel="nofollow">ServletGuru.com</a> the Companion site.