I can't seem to figure out alternatedocroot. I have looked at other questions on stackoverflow, and at the oracle docs for glassfish (but they are as clear as mud to me).
I have a maven project with web, ejb, ear, and an aggregator/parent module. In the web module/project I have added a glassfish-web.xml file with the following entry:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<property name="alternatedocroot_1" value="from=/images/* dir=/images " />
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
I have created an images directory on the root of the Linux box (I'll put it somewhere else once I sort this problem out) and put a "picture.png" file in it. I did a chmod -R 777 /image so permissions should not be an issue.
The welcome.xhtml is this:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
</h:head>
<h:body>
Hello World
<h:graphicImage url="/MyProject-web/images/picture.png"
height="200"
width="960" />
</h:body>
</html>
All I see when I run the project is the
"Hello World"
This is the URL in the browser when run:
http://localhost:8080/MyProject-web/
Can someone help me with the property / directory setup / and image url in the xhtml file?