我已经配置了通配符来提供来自这样一个特定上下文的图像.
<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:图形图像添加了webapp上下文根,这样src标记就变成了/myapp/images/009.jpg。
我的问题是,如何获得服务器本身的路径,以便向其添加/images/并解析正确的路径?或者如何避免web应用程序的上下文根被添加到路径中?
发布于 2014-04-07 17:43:46
从BalusC那里得到了另一个问题的答案(坚持普通img)。check it here
https://stackoverflow.com/questions/22916165
复制相似问题