wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Communication between servlets of two different applications in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply locked New topic
Author

Communication between servlets of two different applications in Tomcat

Matt Thomassan
Ranch Hand

Joined: Dec 23, 2008
Posts: 44
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communication between servlets of two different applications in Tomcat