I'm experiencing a very weird problem. I want to be able to serve images that are stored in my DB and represented as JPA entities. I have it working on a JSF page like this:
page descriptor:
<page login-required="false" view-id="/view/image.xhtml"> <rewrite pattern="/p/image/{id}/{filename}" /> <rewrite pattern="/p/image/{id}" /> </page>
page source:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <s:resource xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" data="#{imageFileFinder.data}" contentType="#{imageFileFinder.contentType}" fileName="#{imageFileFinder.filename}" />
... and of course my ImageFileFinder just does a basic find-command based on the id request parameter.
The webapp is currently hosted on two virtual hostnames. It works great when I try it on one of the hostnames:
https://my-first-hostname.com/p/image/1/helloworld.png
But on the other hostname I'm experincing a redirect,
- from: https://my-second-hostname.com/p/image/1/helloworld.png
- to: https://my-first-hostname.com/seam/docstore/document.seam?docId=1&cid=30
Notice that I get redirected to the first hostname! And I have no idea why I get redirected in the first place...
I'm running a JBoss 5.1 server and Seam 2.2.1-CR2. The virtual hostnames are configured using JBoss-web's server.xml, like this:
<Host name="mywebapp" autoDeploy="false" deployOnStartup="false" deployXML="false"> <Alias>my-first-hostname.com</Alias> <Alias>my-second-hostname.com</Alias> </Host>