Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Communication between servlets on diff war file, but same app server

 
Mohan Karthick
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we talk to another servlet residing at two differetn war but same ear file deployed in same app server..

Thanks

Mohan
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean both servlets are in dfferent contexts and the part of different applications.

You can call "sendRedirect()" by passing an absolute URL. But you will not be able to share the same session and application context.
 
Mohan Karthick
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean that one servlet is calling other servlet and getting some output from that, and both servlet is having different servletcontext as these are in different war file but single ear file.

suppose one war file is just for authetication purpose I want to query a DB from this servlet and get some constant. once i get this constant i can check the main servlet whether user have given same constant or not.
basically i want to invoke a public method of a servlet(diff war) from my a servlet in my war.

I understand that this is not needed logically, we can do it in one war file, but take the scenario

send redirect will create a new request, and pervious request will no more available.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would avoid spreading your app out over different war files unless you have a real pressing need to do so.

You can't carry a session or request from one context to another.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic