This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Servlets and the fly likes Communication between two web applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Communication between two web applications" Watch "Communication between two web applications" New topic
Author

Communication between two web applications

Anand Sivathanu
Ranch Hand

Joined: Jun 25, 2010
Posts: 76
Hi Friends,

I need to communicate to a servlet present in another web application of the same web container.

As I googled, I found of using getServletContext().getContext("/Cart");

Current web application is "HelloWorld" and I need to commuicate to Cart.

So i invoked


But I printed the value of otherContext, it is null.

so I not able to forward the req and res.



Please help.

Regards,
Anand
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
Generally, this won't work. It can be made to work on some servlet containers via proprietary means. For Tomcat, that's what the crossContext attribute does.
Anand Sivathanu
Ranch Hand

Joined: Jun 25, 2010
Posts: 76
Thanks for your reply Ulf Dittmer. I will try the CrossContext
Mr. Ankur Garg
Greenhorn

Joined: May 27, 2012
Posts: 6

In a security conscious environment, the servlet container may return null for a given URL.
just check out about security issues..


Ankur Garg (SCJP,SCWCD)
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Communication between two web applications
 
jQuery in Action, 3rd edition