Hi all, I have a simple Filter.
The role of the filter is essentially to "lazy load" a static resource in to the space of my webapp from an external repository so that Tomcat can serve it directly. The goal was to store this content out side of the web app so that I could easily upgrade and deploy bug fixes and changes without losing the actual data, but still allow Tomcat to do the actual serving of the content. I want Tomcat to serve up the content simply because the stock container does it very well, is well tested, knows all the mime types, etc. vs writing a servlet that reads from the external repository and then streams it out itself. That, to me, is pretty redundant for a simple task of serving "static" resources. The problem that I'm having, however, is when I ask for a "non-existent" resource. Specifically, consider if I ask for http://example.com/myapp/static/xyz.jpg. In a normal webapp, you would have a static folder containing xyz.jpg, and tomcat would simply serve it up straight. I have my filter intercepting on /static, it checks the local web app dir and notices that the file, xyz.jpg, does not exist and proceed to copy it in to the web app directory. Then it simply does a Filter chain to let the request proceed. The problem is that when a resource is freshly copied, Tomcat replies with a 404, even though it fired my filter, and my filter has copied the resource. It's "pre-determined", even before firing my filter, that the resource does not exist, and fails anyway, even though I put the resource where it belongs before I continue on the request chain. When I make a new request, Tomcat sees the new file and serves it up normally. Anyone have any thoughts on how to get around this? If not, can someone point me to the handle static resource code in the tomcat source base so I can yank it out and put it in my own application? It's seems like a silly thing to do, cutting and pasting that handler logic, but doing it AGAIN, is an even sillier thing to do. Regards, Will Hartung ([EMAIL PROTECTED]) --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]