Java: fetching the list of file names in a directory inside a war file
I have a web application in a servlet container.
How can I get the list of files inside security folder inside controller/servlet?
I tried something like this(which is not working):
File security_image_dir = new File("/beta/images/security/");
String security_images[] = security_i开发者_JS百科mage_dir.list();
The standard way of accessing files within a web environment is ServletContext.getResourceAsStream(String). If you want to get a list of files then you can try ServletContext.getResourcePaths()
精彩评论