Re: RequestDispatcher.forward between 2 virtual hosts defined in the same Tomcat container

2015-08-11 Thread Mark Thomas
On 06/08/2015 13:40, Neha Munjal wrote:
> 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.

No.

Mark


> 
> So, I have configured 2 different virtual hosts in my Tomcat server.xml as
> follows:
> 
>  
> 
> and put the root.xml file for default webapps to:
> 
> $CATALINA_HOME/conf/Catalina/ 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
> 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RequestDispatcher.forward between 2 virtual hosts defined in the same Tomcat container

2015-08-06 Thread Neha Munjal
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:

 

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

$CATALINA_HOME/conf/Catalina/ 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