开发者

Java: fetching the list of file names in a directory inside a war file

开发者 https://www.devze.com 2023-03-13 04:05 出处:网络
I have a web application in a servlet container. How can I get the list of files inside security folder inside controller/servlet?

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()

0

精彩评论

暂无评论...
验证码 换一张
取 消