当前位置: 代码迷 >> Web前端 >> 怎么得到服务器路径(weblogic-domain)
  详细解决方案

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

热度:589   发布时间:2012-11-05 09:35:12.0
如何得到服务器路径(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;
	}
  相关解决方案