You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Erik Earle <er...@hotmail.com> on 2004/07/13 21:13:12 UTC

RE: Is there such a beast ? (virtual directories)

This goes against the grain of the servlet spec. Generally, images would be 
something tied to a web application and would therefore be contained within 
the application war file (or directory) so that the webapp would be deployed 
as a single unit.

...but I'm not a puriest so have at it :P

One option is to use a servlet that serves static files from directories and 
map that servlet in your web application's web.xml.  This is nowhere near as 
robust or secure as putting httpd infront of your servlet containers.  Again 
since this _could_ point outside the application directory it's a poor 
solution.

Otherwise (as in Carl's suggestion): You can "overlap" URI mappings to 
contexts.

So you can map:

/app1  ->   fooApplication.war
/app1/images  -> /usr/home/tomcat/images

as long as your images directory is a deployable web application.


----Original Message Follows----
From: "Mike Curwen" <g_...@globallyboundless.com>
Reply-To: "Tomcat Users List" <to...@jakarta.apache.org>
To: <to...@jakarta.apache.org>
Subject: Is there such a beast ?  (virtual directories)
Date: Tue, 13 Jul 2004 10:12:56 -0500
MIME-Version: 1.0
Received: from mail.apache.org ([209.237.227.199]) by mc4-f28.hotmail.com 
with Microsoft SMTPSVC(5.0.2195.6824); Tue, 13 Jul 2004 08:13:17 -0700
Received: (qmail 41774 invoked by uid 500); 13 Jul 2004 15:13:05 -0000
Received: (qmail 41755 invoked by uid 99); 13 Jul 2004 15:13:05 -0000
Received: from [139.142.220.22] (HELO brad.globallyboundless.com) 
(139.142.220.22)  by apache.org (qpsmtpd/0.27.1) with ESMTP; Tue, 13 Jul 
2004 08:13:02 -0700
Received: from BALTHAZAR ([10.0.0.111])by mail.gb-im.com (8.10.2/8.10.2) 
with ESMTP id i6DFCuV12696for <to...@jakarta.apache.org>; Tue, 13 Jul 
2004 10:12:56 -0500
X-Message-Info: JGTYoYF78jFNeFApfa+UFHTL+Uj4Gjtk
Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm
Precedence: bulk
List-Unsubscribe: <ma...@jakarta.apache.org>
List-Subscribe: <ma...@jakarta.apache.org>
List-Help: <ma...@jakarta.apache.org>
List-Post: <ma...@jakarta.apache.org>
List-Id: "Tomcat Users List" <tomcat-user.jakarta.apache.org>
Delivered-To: mailing list tomcat-user@jakarta.apache.org
X-ASF-Spam-Status: No, hits=0.0 required=10.0tests=FROM_HAS_ULINE_NUMS
X-Spam-Check-By: apache.org
Message-ID: <00...@BALTHAZAR>
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.3416
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
X-Virus-Checked: Checked
Return-Path: 
tomcat-user-return-105270-erikearle=hotmail.com@jakarta.apache.org
X-OriginalArrivalTime: 13 Jul 2004 15:13:17.0305 (UTC) 
FILETIME=[ECD2AE90:01C468EB]

Hello all,

I had a friend ask me on the phone a couple days ago, and now a question
has popped up at javaranch. I've looked in the docs and googled, but
haven't found a definitive 'no' answer (shouldn't life be that simple?).
Thought I'd ask here.

Is there such a thing as directory aliasing / virtual directories (like
you get in Apache), available in Tomcat?

so you'd specify that /images is *really* over here at
/usr/local/some/funky/place/images

I like to tell people they don't need Apache, unless they're doing
"special" stuff.  Would this be one of those "special" things ?




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

_________________________________________________________________
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/


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


RE: Is there such a beast ? (virtual directories)

Posted by Justin Ruthenbeck <ju...@nextengine.com>.
At 12:13 PM 7/13/2004, you wrote:
>One option is to use a servlet that serves static files from directories 
>and map that servlet in your web application's web.xml.  This is nowhere 
>near as robust or secure as putting httpd infront of your servlet 
>containers.  Again since this _could_ point outside the application 
>directory it's a poor solution.

This approach is what we've done to use shared resources (static content) 
amongst multiple apps.  In some deployment environments, running Apache 
in front of Tomcat is a no-go for our customers, so implementing this way 
allows us to *optionally* use Apache:

If Apache present, image is at http://www.site.com/images/a.gif
and physically at /.../images/a.gif
If Apache is not present, image is at 
http://www.site.com/webAppA/static?a.gif
and physically at /.../images/a.gif

Point being, implementing the serving as a separate servlet can give you 
additional flexibility at deployment time.  The assertion that this 
diminishes robustness and/or security must be taken in context -- in many 
situations, this can be preferable to running with Apache in front.  As 
always, YMMV.

justin


>Otherwise (as in Carl's suggestion): You can "overlap" URI mappings to 
>contexts.
>
>So you can map:
>
>/app1  ->   fooApplication.war
>/app1/images  -> /usr/home/tomcat/images
>
>as long as your images directory is a deployable web application.
>
>
>----Original Message Follows----
>From: "Mike Curwen" <g_...@globallyboundless.com>
>Reply-To: "Tomcat Users List" <to...@jakarta.apache.org>
>To: <to...@jakarta.apache.org>
>Subject: Is there such a beast ?  (virtual directories)
>Date: Tue, 13 Jul 2004 10:12:56 -0500
>
>Hello all,
>
>I had a friend ask me on the phone a couple days ago, and now a question
>has popped up at javaranch. I've looked in the docs and googled, but
>haven't found a definitive 'no' answer (shouldn't life be that simple?).
>Thought I'd ask here.
>
>Is there such a thing as directory aliasing / virtual directories (like
>you get in Apache), available in Tomcat?
>
>so you'd specify that /images is *really* over here at
>/usr/local/some/funky/place/images
>
>I like to tell people they don't need Apache, unless they're doing
>"special" stuff.  Would this be one of those "special" things ?


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