I guess I'm confused.
Why aren't you simply letting GF serve the images for you? i.e. why are you streaming at all? Are the images not part of your application?
How is mod_jk et al relevant to this issue?
Glassfish has "alternate doc roots" which will let you "mount" directories within your web app.
Let's take a simple example.
Let's say that you want to have a directory in your Webapp for external images.
We'll place that directory at /ext_images.
So,
http://example.com/yourapp/ext_images/picture.png would be the URL for an image.
On your disk, you will create the directory "/var/altdocroot/ext_images" and simply copy your image files in to that directory.
Then, you would add the following to your sun-web.xml:
[code]
<property name="alternatedocroot_1" value="from=/ext_images/* dir=/var/altdocroot">
<description>External Image mapping</description>
</property>
[/code]
Trust me on this, this is the most aggravating bit of configuration, but it does work.
Let me explain.
First, "alternatedocroot_1" is a key word for the property that GF looks for. If you want more mappings, just use _2, _3, etc.
Value is the point, WITHIN YOUR WEB APP that you want to "mount" the external directory.
Dir is the "root" of that external directory.
And here's the nut.
What folks think is happening is that the web app directory "/ext_images" (in this case) is the same as "/var/altdocroot". And that's not the case, and it's not obvious either.
Rather, "/var/altdocroot" is exactly that -- a DOC ROOT. When GF get a URL for /ext_images, it will prepend the alternate docroot, /var/altdocroot, to the URL. Thus /ext_images becomes /var/altdocroot/ext_images.
So, for our example of
http://example.com/yourapp/ext_images/picture.png, that in fact gets mapped to "/var/altdocroot/ext_images/picture.png".
When first playing with this everyone (everyone!) gets it wrong right out the gate, and it can be tricky to debug.
So, hopefully this will explain how to set it up and how it works so that you can use it first time.
Once you've mounted this external directory using the alternatedocroot, then GF will simply serve those files up for you just like any other static resource. It's a great facility to let you separate your WAR application from a large amount of static data that you don't want to have to constantly recopy and redeploy.
[Message sent by forum member 'whartung' (whartung)]
http://forums.java.net/jive/thread.jspa?messageID=329272