什么是Servlet等效的Server.MapPath?

Dav*_*ave 4 c# java asp.net servlets

我的Web应用程序中有一个文件夹,字体.我想获取该目录中每个文件的路径.我怎么做?在asp.net中,我会做类似的事情:


 System.IO.Directory.GetFiles(Server.MapPath("/fonts"))
Run Code Online (Sandbox Code Playgroud)

mat*_*t b 6

String path = ServletContext.getRealPath("/fonts");
Run Code Online (Sandbox Code Playgroud)

Javadoc.