This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Tomcat Apache mod_jk2 Caching Resource Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat Apache mod_jk2 Caching Resource Files" Watch "Tomcat Apache mod_jk2 Caching Resource Files" New topic

Tomcat Apache mod_jk2 Caching Resource Files

Govarthanan Pillai

Joined: Aug 10, 2004
Posts: 1

With this configuration we have a servlet which basically retrieves the resource file like (image,css,xml files) many times from different URLs

Way:1 (using URLConnection )
URL siteURL = new URL(urlPath);
URLConnection siteConn = siteURL.openConnection();
InputStreamReader isReader =new InputStreamReader(siteConn.getInputStream());

int i = -1;
StringBuffer respBuff = new StringBuffer();

while(( != -1) {
ServletOutputStream sos = response.getOutputStream();

Way:2 (using URL )
DataInputStream dis = new DataInputStream(url.openStream());
while ( != -1) {

Actually the servlet is invoked many times for the same resources again and again. We want to avoid that and we want a way to configure a particular list of resource files(cache only which has extensions xml, gif etc) to be cached automatically by Apache.

Or other way is we can also pass an extra parameter along with the URL which decides whether this has to be cached or not. Like
this should be cached by Apache
this should not be cached by Apache

Any solution?

Thanks in Advance,
It is sorta covered in the JavaRanch Style Guide.
subject: Tomcat Apache mod_jk2 Caching Resource Files
Similar Threads
Need suggestions for improving the performance of the Tomcat server in production environment
how to copy files form server to local path?
downloading a dll or a jar
URLConnection & writing HTML back to browser
HTML source code into a text file