Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Interest »

Re: Servlet chaining in different web context

Ruhela, Anurag

2005-08-16


Message
Hi Prashant,
Get the servletcontext of the war application you might want using:
 
    ServletContext ctx = getServletContext().getContext("/war1");
    //war1 is the context root of war1.war

 And then obtain the requestDispatcher as follows:

    RequestDispatcher rd = ctx.getRequestDispatcher("some_path" );
    rd.forward();
 
You might want to check out http://forum.java.sun.com/thread.jspa?threadID=638359&messageID=3738205 for more information.
 
Hope this helps,
Anurag.
   
-----Original Message-----
From: A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE-INTEREST@JAVA.SUN.COM] On Behalf Of Parab, Prashant
Sent: Tuesday, August 16, 2005 11:00 AM
To: J2EE-INTEREST@JAVA.SUN.COM
Subject: Servlet chaining in different web context

Hi Group

In our project we are making different web modules. All these web modules are packaged in a form of war files. We have one more web module which acts as a controller web module which is also packed in a war file. So we have following files present in the server

 

 

WAR1.war

WAR2.war

WAR3.war

 

WARCONTROLLER.war

 

The planned flow is, first the user request will hit the controller web module (WARCONTROLLER.war) and then depending on the some decisions it will route the request to one of the web module (WAR1.war/WAR2.war/WAR3.war). In all the war file there is a servlet which handles the request. So it looks clearly like a servlet chaining case, where servlet present in WARCONTROLLER.war will chain the call to other servlet present in different WAR files.

 

As these servlets are part of their own web context they are invisible to each other. So how it is possible to do a servlet chaining by considering the fact mentioned above. We don’t want to go for request redirect thing because that will hit us in performance. As for as possible this routing should happen inside the server only.

 

 

Will you kindly help me to solve this puzzle?

 

 

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".

=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".

©2008 junlu.com - Jax Systems, LLC, U.S.A.