}
private File getFileRoot() {
String rootPath = getInitParameter(ROOTPATH_PARAMETER);
if (rootPath == null) {
throw new WebdavException("missing parameter: "
+ ROOTPATH_PARAMETER);
}
if (rootPath.equals("*WAR-FILE-ROOT*")) {
String file = LocalFileSystemStore.class.getProtectionDomain()
.getCodeSource().getLocation().getFile().replace('\\', '/');
if (file.charAt(0) == '/'
&& System.getProperty("os.name").indexOf("Windows") != -1) {
file = file.substring(1, file.length());
}
int ix = file.indexOf("/WEB-INF/");
if (ix != -1) {
rootPath = file.substring(0, ix).replace('/',
File.separatorChar);
} else {
throw new WebdavException(
"Could not determine root of war file. Can't extract from path '"
+ file + "' for this web container");
}
}
return new File(rootPath);