I have a folder in my web application, fonts. I would like to get a path for each of these files in this directory. How can I do it? In asp.net, I would do something like:
System.IO.Directory.GetFiles(Server.MapPath("/fonts"))
String path = ServletContext.getRealPath("/fonts");
Javadoc .
For this purpose, you can use the getResourcePaths (String path) method from the ServletContext class. It will return a Set with a resource list directory for the specified (bound to the web application) path.
, , getResourceAsStream() ServletContext, InputStream .
java.io.File dir = new java.io.File("/fonts"); String[] files = dir.list();
Source: https://habr.com/ru/post/1709788/More articles:WPF On Start определяет, запущен ли процесс и приносит приложение на передний план - c#Opening a ZIP file multipart / form-data with rubyzip - ruby | fooobar.comWhat is better CakePHP or pure PHP for a huge project? - frameworksCan you return multiple result sets using PDO and PostgreSQL? - phpAlternative to notification services - sql-serverHow can I stretch a div to 100% of the page height? - cssRails - attr_accessible & mass assign - ruby | fooobar.comКак написать этот запрос в ZF? - sqlWhat are common mistakes when developing a new SQL database? - sqlJavascript: have an onload function to load until scripts are complete - javascriptAll Articles