This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Synchronizing file access across contexts is tricky. Or is just read-only access?
Obviously, you'need to know the path to the file, which includes the name of the other web app, and its internal structure. This goes a bit against the encapsulation one is trying to achieve with web apps. Maybe it would be possible for the web apps to only access their own files, and have the others make HTTP requests to it? Or move the common files to a shared directory somewhere else?
Ping & DNS - updated with new look and Ping home screen widget
Joined: Mar 22, 2005
Ah. Now I see that you're actually talking about requests, not files.
You can use the java.net.HttpUrlConnection class to make HTTP requests, or -for more features- the Jakarta Commons HttpClient library. What kind of data were you thinking of sending back to the calling web app?
There is a method on the ServletContext object that allows for access to another WAR's servlet context - DEPENDING ON THE VENDOR's IMPLEMENTATION. If you call the getContext(java.lang.String uripath) with another WAR's servlet context - it will give you a reference to that web apps servlet context. I beleive that is the default implementation for weblogic, but again, your mileage may vary