You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Félix Pedrera García <fe...@deimos-space.com> on 2007/11/26 16:07:43 UTC

Access to static external resources from a webapp in Tomcat 5.5.25.

Hello,

For a webapp deployed on Tomcat 5.5.9 to access static external resources (images, videos, etc), which we don't want to be deleted when the application is undeployed, we use the following entry on the context.xml file of the webapp, under the META-INF directory of the web application:

<Context docBase="/path/to/resources" path="/contents">
    <Resources className="org.apache.naming.resources.FileDirContext"/>
</Context>

Having configured this, we can access the files under /path/to/resources through the URL http://localhost:8080/contents.

This worked perfectly with Tomcat 5.5.9, but when upgrading to Tomcat 5.5.25 the webapp cannot access the external resources we place outside of the Tomcat webapps directory.

Which is the proper method to access external resources from a webapp has been defined from version 5.5.10?

This issue has been notified previously to the list, some answers where the following 

"You don't explicitly say where your <Context> element is, but the
implication is that it's inside a file named context.xml in your
webapp's META-INF directory.  If that is the case, both the path and
docBase attributes are ignored.  See:
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
Look at the descriptions for the two attributes in question.  The
docBase attribute is intended to provide the location of the webapp, not
a link to external resources.

Tomcat versions after 5.5.9 seem to have tightened up enforcement of the
configuration rules."

I understand these attributes are intented to provide a location of the webapp, but in this case, how do I access to static external resources from a webapp in Tomcat 5.5.25? 

Thanks in advance,

--
Félix Pedrera.



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org