You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Saikat Chatterjee <sa...@interrait.com> on 2000/12/08 10:16:50 UTC
Application Path
Hello All,
I have a question regarding application path in Tomcat. I have
loaded and application named "myapp" under 'webapps' of Tomcat. Now, is it
possible to know the full path of my application "myapp"?[i.e upto and including
the folder 'myapp']
Thanks in advance,
Saikat
Re: Application Path
Posted by Jon Skeet <jo...@peramon.com>.
> Hello All,
> I have a question regarding application path in Tomcat. I have
> loaded and application named "myapp" under 'webapps' of Tomcat. Now, is it
> possible to know the full path of my application "myapp"?[i.e upto and including
> the folder 'myapp']
Within a request, use something like the following:
String requestURL = HttpUtils.getRequestURL (req).toString();
String path = req.getPathInfo();
if (path==null)
servletURL=requestURL;
else
{
if (!requestURL.endsWith (path))
{
// Panic and use something else... your choice!
}
else
servletURL = requestURL.substring (0, requestURL.length()-path.length());
}
Jon