ITeye博客

getRealPath方法为何返回的是null

ultrang · 2015-09-29 08:59 · 代码质量 · 中间件 · 编程语言 · Markdown

在WebLogic 11的weblogic.xml中可以自定义show-archived-real-path-enabled参数的值,用于使request.getSession().getServletContext().getRealPath("")方法在返回实际路径。

<container-descriptor>
        <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
    </container-descriptor>

此参数对于打包的(归档的)web应用程序生效,当设置为true时,getRealPath()返回资源对应的实际路径。否则返回null。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。