简体   繁体   中英

Tomcat cache downloaded files

I use a library that downloads xml files from internet and use it. Sometimes these files are unavailable and to avoid it I would like to cache downloaded files. Is there a possibility to tell Tomcat to cache downloaded xml files and not download these again?

And how should Tomcat even know about the library you're using and this special behaviour you want? Tomcat does not 'download files'. Its your application that is doing it.

Shouldn't you do this yourself when using the library (unless the library already provides this)? Ie when you get the xml files store them in a folder, and next time you need them you first check the local folder if they exist and if not (or if they're too old) try to get them online, and save them (or overwrite them) with the new files you get.

Your question doesn't make sense. Tomcat is the source. Caching there doesn't accomplish your objective in the slightest. Fortunately the Internet is already full of caches, as is your browser, so your question is already answered by the existing state of things.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM