tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: SOLVED: How to get the context path for a web application?
Date Fri, 13 Aug 2004 16:50:01 GMT
Quoting David Wall <d.wall@computer.org>:

> >        contextPath = path.substring(0, path.lastIndexOf("/"));
> >        contextPath = contextPath.substring(contextPath.lastIndexOf("/") +
> 1);
> 
> This looks like a reasonable hack, but isn't it true that the filesystem
> path and the context path don't have to match?  For example, I can map "" to
> /webapps/ROOT can't I?  Or map "/myapp" to "/webapps/somethingelse"?
> 
> David

The path returned by context.getResource("/") has nothing whatsoever to do with
the file system.  By your logic, my app located at
"C:\apps\myappbuld\target\war", using said method above, would end up with the
value "war".  Yet, it ends up with whatever I set the "path" to in my context
configuration file.

If you want to continue to challenge this, do the test yourself.  If you find
something different than what I describe, let me know.


Jake

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


Mime
View raw message