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 11:34:20 UTC

Serving static resources outside webapp in Tomcat 5.5.25

Hello,

We have a web application ("app") running on Tomcat 5.5.9 deployed on 
the default tomcat webapp directory ([TOMCAT_HOME]/webapps). This 
application has a "context.xml" file which defines access to static 
external resources (image files, video files, etc.) this way:

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/app/resources" path="/contents" >
   <Resources className="org.apache.naming.resources.FileDirContext" />
</Context>

These file can be accessed correctly. For example with the following URL 
http://localhost:8080/contents/image.gif the image located in 
/app/resources/image.gif. is shown.

We are upgrading Tomcat version from 5.5.9 to 5.5.25, and with the new 
version, it is impossible to access the external files with the 
context.xml definition it used to work in Tomcat 5.5.9.

What has been changed from version 5.5.9 and which is the way to access 
external static 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


Re: Serving static resources outside webapp in Tomcat 5.5.25

Posted by Mark Thomas <ma...@apache.org>.
Caldarale, Charles R wrote:
>> From: Mark Thomas [mailto:markt@apache.org] 
>> Subject: Re: Serving static resources outside webapp in Tomcat 5.5.25
>>
>> Adding the following, as contents.xml, to your webapps 
>> directory should work
>> <?xml version="1.0" encoding="UTF-8"?>
>> <Context docBase="/app/resources" >
>> </Context>
> 
> I think you mean to place the above <Context> element in
> conf/Catalina/[hostname]/contents.xml, not webapps/contents.xml.

Yep. Getting my versions mixed up. Sorry.

Mark



---------------------------------------------------------------------
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


RE: Serving static resources outside webapp in Tomcat 5.5.25

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mark Thomas [mailto:markt@apache.org] 
> Subject: Re: Serving static resources outside webapp in Tomcat 5.5.25
> 
> Adding the following, as contents.xml, to your webapps 
> directory should work
> <?xml version="1.0" encoding="UTF-8"?>
> <Context docBase="/app/resources" >
> </Context>

I think you mean to place the above <Context> element in
conf/Catalina/[hostname]/contents.xml, not webapps/contents.xml.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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


Re: Serving static resources outside webapp in Tomcat 5.5.25

Posted by Mark Thomas <ma...@apache.org>.
Félix Pedrera García wrote:
> What has been changed from version 5.5.9 and which is the way to access
> external static resources from a webapp in Tomcat 5.5.25?

The checking for valid context configuration has been tightened.

Adding the following, as contents.xml, to your webapps directory should work

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/app/resources" >
</Context>

Mark



---------------------------------------------------------------------
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