Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Abhishek Reddy
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually i was asked this in an interview ....
 
Frank Kellinghusen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you not try opening a HTTPURLConnection to the other servlet ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic