If you are serving these verbatim from the database with no other processing, I think you should consider caching them in the file system for much better performance.

You can do this by creating a 404 handler that checks if the requested file could be got from the database. If it can, it writes it to the pageroot and returns it. The next time someone requests it, AOLserver will serve it straight from the file system.

If you upload a new version of the file to the database, that proc should then simply delete the existing file from the pageroot.

Here's an example:

http://panoptic.com/wiki/aolserver/AOLserver_Cookbook#Fast_caching_of_generated_pages

Regards,
Bas.

On 18/11/2007, at 9:07 AM, J. Greg Davidson wrote:

What is the best way to serve script (*.js and *.css)
and image (*.png and *.svg) files which are stored in
a database?

I am successfully using ns_register_proc to catch and
dynamically serve html page requests.

I would also like to dynamically serve the script and
image files that are embedded in those same html files.

I've tried, for example:
       ns_register_proc GET /Images/*.png serve_image
and
       ns_register_proc GET /*.png serve_image
to catch requests for my .png files, but my procedure
serve_image does not get called.

What am I missing?

Thanks,

Greg Davidson


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED] > with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to