Link to file outside context root of weblogic

醉酒当歌 提交于 2019-12-11 01:38:13

问题


If I want to display an image in my webpage and its src is a file outside context root. At the IDE, the image is shown to be loaded.

But when I test the web page, nothing displayed. How can I config weblogic server to allow the image to be displayed. If not is there anyway to run around this problem.

Thanks a lot.


回答1:


You can use the Virtual Directory Mapping feature (that you declare in the weblogic.xml):

Using the virtual directory mapping feature, you can create one directory to serve static files such as images for multiple Web Applications. For example, you would create a mapping similar to the folowing:

<virtual-directory-mapping>
  <local-path>c:/usr/gifs</local-path>
  <url-pattern>/images/*</url-pattern>
</virtual-directory-mapping>

A request to http://localhost:7001/mywebapp/images/test.gif will cause your WebLogic Server implementation to look for the requested image at: c:/usr/gifs/images/*.

This directory must be located in the relative uri, such as "/images/test.gif".



来源:https://stackoverflow.com/questions/2505078/link-to-file-outside-context-root-of-weblogic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!