I have a servlet that must call another servlet, read its response and run a database query based on that response. How do I do that? I know of sendRedirect() and RequestDispatcher's methods but they would transfer control to this second servlet which I don't want.
Whenever I want to call another web application from Java I use HTTPUnit. It's marketed as a web application test framework, but it also contains a neat but powerful way to send stuff to remote web apps and read the result in a useful way.
Also, couldn't you try and wrap the url to your servlet in a java.net.URL, and then return the InputStream from the java.net.URLConnection object. Craig.
How about using a filter? Umm, I'm having trouble seeing how using a filter might be at all helpful in this case. Can you give any more details of your solution idea?