Forums Register Login

Caching static files

+Pie Number of slices to send: Send
I have a tomcat based web application. I am using JSP as the presentatio tier. I have a lot of static files(html, png, jpg) files which do not change in the lifetime of server instance. I want to know how I can improve loading of these files on the client(browser)
+Pie Number of slices to send: Send
In normal circumstances the browser will cache static files without being told to. Is this not happening in your configuration?
+Pie Number of slices to send: Send
I think this is not happening. Let me know how I can configure the browser.
+Pie Number of slices to send: Send
I have no idea. (Besides, you didn't say which browser.) Browsers come configured to cache content by default, so you must already have done something to your browser to stop it from doing that. Whatever it was, undo it.
+Pie Number of slices to send: Send
Also make sure that during a deployment the timestamp on files that have not changed stays the same as before. That helps by causing a 304 response to be returned for files that have not changed since the browser last requested them.
+Pie Number of slices to send: Send
Thanks for the suggestion. Will look and reset the browser settings.
+Pie Number of slices to send: Send
One obvious solution is to not reference the static files through your JSP/servlet. Put them on a simple web server, and include the URL. Let the browser and Apache (or whatever you use) do the optimization.

Some high volume sites go so far as to have a separate static host and DNS entry, something like "http://images.coderanch.com" that used for all images.
Could you hold this kitten for a sec? I need to adjust this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1147 times.
Similar Threads
Size of deployed WAR file and JBOSS performance.
install jdk vista problem
Websphere: prevent downloading of static content
Static files deployment with changing jboss config files
Relative file paths in JSP
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:26:42.