1
我已经wildfly配置为从一定的语境中这样的服务图片...H:graphicImage的价值属性:如何获取服务器的路径,而不是Web应用程序上下文根
<subsystem xmlns="urn:jboss:domain:undertow:1.0">
<server name="default-server">
<host name="default-host" alias="localhost">
<location name="/images" handler="book-images"/>
<!-- More config-->
</host>
<!-- More config-->
</server>
<handlers>
<file name="book-images" path="/path/to/book/images"
directory-listing="true"/>
<!-- More config-->
</handlers>
<!-- More config-->
</subsystem>
本质上讲,这使得有可能访问野蛮档案在localhost:8080/images
我可以从浏览器访问图像,例如localhost:8080/images/009.jpg
。
我要的是能够在img
使用这些图片从一个Web应用程序标签即
<h:graphicImage value="/images/#{bookid}.jpg" />
但H:graphicImage的增加了web应用程序上下文根,这样src
标签变得/myapp/images/009.jpg
。
我的问题是,我如何得到服务器本身的路径,这样我可以添加/images/
它和解决的正确道路?或者我如何避免Web应用程序的上下文根被预先添加到路径中?