tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hua Hou <...@handango.com>
Subject Question with ServletContext.getContext(anotherContextName) under TomCat
Date Wed, 23 Apr 2003 21:38:28 GMT
All,

I am trying to achieve inter-context communication between different
contexts by using ServletContext.getContext(context name) API. I set up the
server.xml as following:

      <Host name="siteA.mycompany.com" debug="0" appBase="webapps" 
       unpackWARs="true" autoDeploy="true">
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="microsoft_log." suffix=".txt"
	        timestamp="true"/>
          <Context path="" docBase="siteA" crossContext="true" debug="0" />
          <Context path="/core" docBase="core" crossContext="true" debug="0"
/>
          <Context path="/include" docBase="include" crossContext="true"
debug="0" />
      </Host>

My physical directory structure is:

webapps\core
webapps\include
webapps\siteA

Within a jsp in "siteA" directory, the following code returns null:

context.getContext("/core").getResourceAsStream("foo.jsp");

Although I do have foo.jsp under directory "core".

But within a jsp in "include" directory, the above code works perfectly
fine. It does returns me the file as InputStream.

Is it because the path for siteA is ""? Any way to make it work?

Your help are greatly appreciated.

Thanks.

Hua



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message