Wednesday, 14 August 2013

How to read contents of a directory under WEB-INF from a servlet

How to read contents of a directory under WEB-INF from a servlet

My WEB-INF directory structure is as follows:
WEB-INF
config
staging
I want to list the files under the config directory, for which I tried:
File directory = new File("WEB-INF/config");
File [] flist = directory.listFiles();
But flist is null.
I am able to read an individual file under config directory using
context.getResource(....), but I would like to get the list of files flist
and pass it to another class.

No comments:

Post a Comment