java - Servlet : What exactly the use of context.getRealPath(" "); -


as know returns application path? use of it.

in many environments application user not allowed read files outside of deployment directory. done security purposes - example if hacks application won't able read passwords file.

and in professionally managed environments developers don't have in directory application placed.

so if need read file properties, images, certificates, etc. can place in application directory (or .war file) , use getrealpath("") path need load.

as alternative can place external files on classpath there issues this. large files app servers try load entire file memory , cache if on classpath.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -