开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜