I want to display external image files under /var/images. To do that, I added another image handler "img" subsystem for the images folder in my configuration/standalone.xml as follows. Now I can browse the folder through http://localhost:8080/img/test.jpg.
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
**<location name="/img" handler="images"/>**
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
**<file name="images" path="/var/images" directory-listing="true"/>**
</handlers>
However, I can't display it correctly in my JSF code below. The image isn't displayed in the html page in browser. Any idea of what's missing or wrong? Thank you.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:p="http://primefaces.org/ui"
>
<ui:composition template="template.xhtml">
<ui:define name="content">
<h:messages />
<h:form id="myform">
<h:panelGrid columns="5">
<h:graphicImage value="/img/test.jpg" />
...
</h:panelGrid>
</h:form>
<br />
</ui:define>
</ui:composition>
</html>