+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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org