1.
获取用户请求的路径:
HttpServletRequest request = (HttpServletRequest)
req;
String servletPath = request.getServletPath();
2. 相对通用的读文件流的方法(Windows 和
Linux上都可以用):
拿到流,然后再去读流中的内容。
InputStream
inputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(CONFIG_FILE_NAME);
原文:http://www.cnblogs.com/kevin-yuan/p/3615971.html