• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Proces a servlet inside another

 
Yash Sharma
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
danny liu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using a filter?
Dan
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic