tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berneburg, Cris J. - US" <cberneb...@caci.com>
Subject RE: getRealPath is a bad idea?
Date Tue, 07 Mar 2017 15:27:08 GMT
 [SNIP]

>> chris S>>> getRealPath is a bad idea. <<<
>> 
>> For my education's sake, would you please explain that?  [SNIP]
>
> There is no guarantee it will return a non-null value. The typical reason
> is if the app is running from a packed WAR. Using it reduces the portability
> of your application.
>
> Mark

Thanks for explaining that.  Never occurred to me that running from a WAR would return null.

I used getRealPath thinking it would *increase* portability, since yet-another-config-option
would not need to be manually set (or verified) after every deployment or in a different environment.
 "Why did the such-and-so fail?  Oh... I forgot to set the folder location - again."  By using
getRealPath the setting never, ever needs to be configured - it's automatic.

But now I may need to rethink that.

BTW, why doesn't getRealPath return the full path to the folder that the WAR file is in instead
of null?

--
Cris Berneburg
CACI Lead Software Engineer


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


Mime
View raw message