tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neha Munjal <neha.munj...@gmail.com>
Subject RequestDispatcher.forward between 2 virtual hosts defined in the same Tomcat container
Date Thu, 06 Aug 2015 12:40:56 GMT
Hi,

I would like to know if we can do servlet forwarding between 2 different
webapps deployed on 2 different virtual hosts configured in the same Tomcat
container.

So, I have configured 2 different virtual hosts in my Tomcat server.xml as
follows:
<Host name="firstservlet" appBase="firstservletapps"/>
 <Host name="secondservlet" appBase="secondservletapps"/>

and put the root.xml file for default webapps to:

$CATALINA_HOME/conf/Catalina/<virtualhost> directory.

servlet2 is deployed as a different war in the 2nd virtual host.

I notice that when I try to fetch the context of servlet2 from
Servlet1 to do a forward from Servlet1 to Servlet2, the loaded context
is null and so there is forwars. Please note that crossContext
attribute is set to true in the context.xml for the 1st war.

Also, noticed that in case I do not define any explicit virtual hosts
and deploy both the wars in the default host i.e localhost, the
forwarding works fine.

Can somebody please let me know if servlet.forward works with virtual hosts.

Any suggestions would be highly appreciated.


Thanks

Neha

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message