This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic

Communication between servlets of two different applications in Tomcat

 
Matt Thomassan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Ranchers,

I had initially posted this doubt in Servlet's forum. I learned this is the more appropriate place for the question.

I have a question regarding invoking a resource from other application in Tomcat.

Consider, there are 2 web applications viz., WebApplication1 and WebApplication2.

WebApplication1 has Servlet1 and WebApplication2 has Servlet2.

How can we forward the request to Servlet2 (in WebApplication2) from Servlet1 (in WebApplication1).

In Servlet1 we can write,



I think we have to play with ServletContext. Somehow we have to get the ServletContext of WebApplication2 in WebApplication1.

All the servlets in the web application have reference to the Servlet Context.

Does Tomcat maintain "something" as a reference to all the Servlet Contexts?

Any ideas are welcome.

Thanks for your time and consideration.

Best Regards
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question in two places. Ask a staffer to move the original.

I have taken care of that for you.

It would have been fine had you pointed out that you are looking for cross-context dispatching, but you just re-posted the same general question.
 
    Bookmark Topic Watch Topic
  • New Topic