aspose file tools*
The moose likes Servlets and the fly likes Communication between servlets on diff war file, but same app server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Communication between servlets on diff war file, but same app server" Watch "Communication between servlets on diff war file, but same app server" New topic
Author

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

Mohan Karthick
Ranch Hand

Joined: Apr 11, 2005
Posts: 199
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

Joined: Aug 15, 2004
Posts: 2874
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

Joined: Apr 11, 2005
Posts: 199
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communication between servlets on diff war file, but same app server