tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: [PROPOSAL] Adding support for aliases to DirContext
Date Thu, 28 May 2009 17:06:18 GMT
+1

I loathe while(true) (but its a personal taste) - here is a shorter non 
while(true) version:

if (!aliases.isEmpty()) {
     String aliasedName = name;
     DirContext dirContext = aliases.get(aliasedName);
     while (dirContext!=null) {
         int slash = aliasedName.lastIndexOf('/');
         if (slash < 0)
             break;
         aliasedName = aliasedName.substring(0, slash);
         dirContext = aliases.get(aliasedName);
     }
     if (dirContext != null) {
         return dirContext.lookup(name.substring(aliasedName.length()));
     }
}

Performing a normalization may come in handy too before performing the 
alias lookup.
String aliasedName =
   RequestUtil.normalize(name, File.separatorChar == '\\');


-Tim


Mark Thomas wrote:
> All,
> 
> I have been looking into adding alias support to DirContext so
> applications can pull in resources from external locations. I looked at
> a couple of alternatives and settled on this patch (against trunk) as a
> starting point:
> http://people.apache.org/~markt/patches/2009-05-26-alias-DirContext.patch
> 
> It works at a basic level but I haven't done much testing and it is
> probably far from complete. Before I go much further, I'm keen to hear
> any feedback, particularly any ideas on alternative implementations that
> might be simpler.
> 
> I'd like to get something like this into trunk for inclusion in Tomcat 7.
> 
> Mark
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 
> 


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


Mime
View raw message