aspose file tools*
The moose likes Servlets and the fly likes how to communicate between 2 servlets which are present in two different web applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to communicate between 2 servlets which are present in two different web applications" Watch "how to communicate between 2 servlets which are present in two different web applications" New topic
Author

how to communicate between 2 servlets which are present in two different web applications

Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
hi every one,

how to communicate between 2 servlets which are present in two different web applications?

case1: two web applications are deployed in the same server (for example tomcat)
case2: two web applications are deployed in two different servers (for example tomcat and weblogic)

need help


Abhishek
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12821
    
    5
Java is loaded with tools for communicating between applications. One of the simplest would be a shared database.

What are the characteristics of the data which needs to be shared?
volume?
rapid change?
transactions?
... etc

Bill
Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
actually i was asked this in an interview ....
Frank Kellinghusen
Greenhorn

Joined: Jul 10, 2009
Posts: 11
Abhishek Reddy wrote:hi every one,

how to communicate between 2 servlets which are present in two different web applications?

case1: two web applications are deployed in the same server (for example tomcat)



You can get the ServletContext of another application running in the same server using getContext(String appUrl):

http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletContext.html#getContext%28java.lang.String%29

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 522
    
    2

Can you not try opening a HTTPURLConnection to the other servlet ?


Regards
KumarRaja

 
wood burning stoves
 
subject: how to communicate between 2 servlets which are present in two different web applications