I have my restlet.Component deployed in Tomcat, in this, i read a configuration file of my app:
this.properties.load(new FileInputStream("config/conf.properties));
I have got a java.io.FileNotFoundException
My webapp structure is:
/mi-webapp
/config
conf.properties
/WEB-INF
/classes
/lib
web.xml
How can i get the real path in restlet? i read about ServletContext.getRealPath() but it’s a bad practice, how do you recommend?
Move the config directory inside
WEB-INF/classesand use this code instead:This way you load the file from the classpath which is within the scope of your application anyway, and doesn’t result in any security holes.