tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Skeet" <jon.sk...@peramon.com>
Subject Re: Application Path
Date Fri, 08 Dec 2000 09:22:38 GMT
> 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

Mime
View raw message