Is it possible to read externalized property files in portlet application by using relative path? If not, could you please advise the best way to read externalized property files in portlet web application?
Per my observation, with relative path - system is loading property file only if the file is present inside web application but not able to access it if the file is externalized.
MWS has some file locators to resolve the real file location for paths:
For example:
//get the real file location
String realFileLocation = com.webmethods.rtl.util.FileUtil.getRealLocation("webroot:/foldername/filename.xml");
//or get an input stream for the file content
InputStream fileInputStream = com.webmethods.rtl.util.FileUtil.getInputStream("webroot:/foldername/filename.xml");
The webroot:/ prefix resolves from MWS/server/default/deploy/portal.war/
…and there are other resolvers for other roots:
The dist:/ prefix resolves from MWS/
The root:/ prefix resolves from MWS/server/default/
The deploy:/ prefix resolves from MWS/server/default/deploy/