So, if you’re using Seam, you usually have xhtml files which represent the pages, and then the Seam servlet takes care of rendering them. When I setup my latest project, I changed the web.xml to switch from using page.seam to page.html, to mask the back-end technology. When I did this, I also deleted the seemly unnecessary index.html that was sitting in my view directory. I then added this into my web.xml, just to be on the safe side:
<welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list>
Everything worked great, when I was hitting the tomcat instance in JBoss. However, as soon as I deployed to my production server, and Apache2 was handling the end user connections and talking to JBoss via ajp13, I kept getting directory listings, instead of the index page. If I typed “index.html” into the browser, it worked fine, but just going to the root of the web-app context root always delivered a directory listing. Not at all what I wanted.
By putting an empty index.html file in my web-app, things worked. I’m assuming that Apache checks to see if the resource exists, and if not, does the whole directory listing thing, ignoring the welcome-file mapping in the web-app. I’m only guessing here, but that seems to be what happened. If so, I’d call this a flaw in the Apache to JBoss request negotiation. Once Apache hands off the request for the index.html, after it’s validated the resource exists, then Seam leaps in and everything works as expected. For whatever reason, it’s only an issue when a request is issued for a directory “/”.
Anyhow, I don’t have all the answers, but I do have a solution for this issue if it bites you. And I wasn’t able to find it on google myself, so hopefully this will be helpful.
Leave a Reply