You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Igor Mukhin <ii...@mail.ru> on 2009/10/02 16:59:21 UTC
Finding out the absolute path to application (appBase)
Hello everybody,
if I have an instance of org.apache.catalina.core.StandardContext
<ci...@mail.ru>, what is the best way two find out
the absolute path to directory where the application is expanded (appBase)?
For instance stdctx.getAppBase() would just return "manager", where
stdctx is "/manager" context.
Is there a method that calculates the absolute path?
Thanks for your answers
Igor
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Finding out the absolute path to application (appBase)
Posted by Uwe Günther <uw...@cscc.de>.
Mark Thomas wrote:
> Caldarale, Charles R wrote:
>>> From: Igor Mukhin [mailto:iimuhin@mail.ru]
>>> Subject: Finding out the absolute path to application (appBase)
>>>
>>> what is the best way two find out the absolute path to directory
>>> where the application is expanded (appBase)?
>> There's no guarantee that the application is expanded, or that components of it exist anywhere in the file system. (Or even that there is a file system.)
>
> +1.
>
>> What is your actual requirement?
>
> If your requirement really is getting the appBase then try;
>
> ((Host) standardContextInstance.getParent()).getAppBase()
>
And maybe enhance the code from Mark with this part just in case appBase
isn't absolute:
String appBaseName =
((Host) standardContextInstance.getParent()).getAppBase();
File appBase = new File(appBaseName);
if (!appBase.isAbsolute()) {
appBase = new File(
System.getProperty("catalina.base"),
appBaseName);
}
--
Uwe
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Finding out the absolute path to application (appBase)
Posted by Mark Thomas <ma...@apache.org>.
Caldarale, Charles R wrote:
>> From: Igor Mukhin [mailto:iimuhin@mail.ru]
>> Subject: Finding out the absolute path to application (appBase)
>>
>> what is the best way two find out the absolute path to directory
>> where the application is expanded (appBase)?
>
> There's no guarantee that the application is expanded, or that components of it exist anywhere in the file system. (Or even that there is a file system.)
+1.
> What is your actual requirement?
If your requirement really is getting the appBase then try;
((Host) standardContextInstance.getParent()).getAppBase()
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Finding out the absolute path to application (appBase)
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Igor Mukhin [mailto:iimuhin@mail.ru]
> Subject: Finding out the absolute path to application (appBase)
>
> what is the best way two find out the absolute path to directory
> where the application is expanded (appBase)?
There's no guarantee that the application is expanded, or that components of it exist anywhere in the file system. (Or even that there is a file system.)
What is your actual requirement?
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org