You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Tiwald <ct...@salsalabs.com> on 2012/03/27 01:04:07 UTC

What is the right way to share resources across contexts?

Apologies if this has been covered before. I did a search of google and
the mailing list archives, and while I found a few threads that danced
around this topic [1], none of them seemed fully applicable.

Following up on Mark Thomas's advice in my duplicate bug-filing at [2],
what is the "right way" to share static assets across contexts and between
servers running tomcat?

Additional information: We're running 7.0.16 on RHEL 6.1, using java 1.6.0_20.
In violation of the servlet specification, we symlinked external client assets
directly into the exploded WAR, and then got burned by ExpandWar.java's
recursive delete method described in [3]. We're now refactoring this
legacy code but would love some advice on the best, most canonical way
to approach the problem.

[1] http://mail-archives.apache.org/mod_mbox/tomcat-users/201003.mbox/%3C99C8B2929B39C24493377AC7A121E21F96CB6802A6@USEA-EXCH8.na.uis.unisys.com%3E
[2] https://issues.apache.org/bugzilla/show_bug.cgi?id=52988#c1
[3] https://issues.apache.org/bugzilla/show_bug.cgi?id=52988#c0

--
Christopher Tiwald

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


RE: What is the right way to share resources across contexts?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Tiwald [mailto:ctiwald@salsalabs.com] 
> Subject: What is the right way to share resources across contexts?

> what is the "right way" to share static assets across contexts and between
> servers running tomcat?

One easy way is to place the static resources under one or more unique <Context>s, with the location of the assets outside of Tomcat's directory space.  Create a conf/Catalina/[host]/[staticName].xml file containing a <Context> element with a docBase attribute pointing to the location of the resources.  Tomcat's standard DefaultServlet will deliver them to clients automatically.

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: What is the right way to share resources across contexts?

Posted by Christopher Tiwald <ct...@salsalabs.com>.
On Tue, Mar 27, 2012 at 09:36:42AM +0100, Mark Thomas wrote:
> On 27/03/2012 00:04, Christopher Tiwald wrote:
> 
> > Following up on Mark Thomas's advice in my duplicate bug-filing at [2],
> > what is the "right way" to share static assets across contexts and between
> > servers running tomcat?
> 
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
> 
> Look for "aliases"

This and the other response are both great solutions. Thank you for
your help.

--
Christopher Tiwald

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


Re: What is the right way to share resources across contexts?

Posted by Mark Thomas <ma...@apache.org>.
On 27/03/2012 00:04, Christopher Tiwald wrote:

> Following up on Mark Thomas's advice in my duplicate bug-filing at [2],
> what is the "right way" to share static assets across contexts and between
> servers running tomcat?

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

Look for "aliases"

Mark

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