怎么得到服务器路径(weblogic-domain)

如何得到服务器路径(weblogic-domain)
对于如何在weblogic中得到web项目路径问题,是很常见的;
前些日子用到了,就记录下大家分享下。
public String getWebInfPath() throws IllegalAccessException {
		String path = getClass().getProtectionDomain().getCodeSource()
				.getLocation().getPath();
		if (path.indexOf("WEB-INF") > 0) {
			path = path.substring(1, path.indexOf("WEB-INF") + 15);
		} else {
			throw new IllegalAccessException("路径获取错误");
		}
		return path;
	}