Hello,

we are using a third party software which accesses files local on the server. 
We must send in our request the "local path" to this files (e.g. 
D:\myserver\webapps\data\thefiles\).
My idea was to write a servelt which delivers me "D:\myserver\webapps" and the 
client application can add the rest of the path because this is a fixed part. 


Yours Rüdiger


-----Ursprüngliche Nachricht-----
Von: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] 
Gesendet: Montag, 19. März 2012 15:31
An: Tomcat Users List
Betreff: RE: Access local path of servlet

> From: Gubler, Ruediger [mailto:rgub...@init-ka.de] 
> Subject: Access local path of servlet

> can I get the local webapps path in a servlet?

Not sure what you mean by "local webapps path".  If you mean the path in the 
local file system, you should be aware that the servlet spec is designed so 
that a servlet container can operate _without_ a local file system, so there's 
no guarantee of such a path existing.

If your goal is to access some resource located with your webapp, follow the 
procedure here:

http://wiki.apache.org/tomcat/HowTo#How_do_I_load_a_properties_file.3F

You should pretty much never use getRealPath(), since it may not be able to 
return anything useful.

 - 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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


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

Reply via email to