请教各位,如何读取war包中的文件

项目要求我下载war包中的文件,我在本地用weblogic发布module的时候可以实现从工程目录中下载,但是打成war包后,用weblogic发布的时候却抛FileNotFound Exception,请各位看看帮忙解决,不胜感激。


public static String getFileName(
String pathKey,
String fileNmKey,
HttpServlet servlet)
{
String configBundleNm = "存放文件路径及文件名的资源文件名";
String fullName = null;

try {
PropertyResourceBundle configBundle =
(PropertyResourceBundle) PropertyResourceBundle.getBundle(
configBundleNm,
Locale.getDefault());

String fileName = (String) configBundle.getString(fileNmKey).trim();
String path = (String) configBundle.getString(pathKey).trim();
String fullPath = servlet.getServletContext().getRealPath(path);
String fileSeparator =
System.getProperties().getProperty("file.separator");
fullName =
new StringBuffer()
.append(fullPath)
.append(fileSeparator)
.append(fileName)
.toString();
} catch (MissingResourceException missE) {

}

File file = new File(fullName);
if (!file.isFile()) {

}

return fullName;

}

我可不可以用servlet来取得war包在服务器上的绝对路径啊?

在war包中放了正确的文件但是


if (!file.isFile()) {
//进入这里了
throw new FileNotFoundExceptiong();
}

难道war包里的文件是不能有绝对路径?