![]() |
|
#1
|
|||
|
|||
Tomcat Apache mod_jk2 Caching Resource File<pre>
Hi, 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(); siteConn.connect(); InputStreamReader isReader =new InputStreamReader(siteConn.getInputStream()); int i = -1; StringBuffer respBuff = new StringBuffer(); while((i=isReader.read()) != -1) { respBuff.append(String.valueOf((char)i)); } ServletOutputStream sos = response.getOutputStream(); sos.write(sBuffer.toString().getBytes()); Way:2 (using URL ) ================== DataInputStream dis = new DataInputStream(url.openStream()); while ( dis.read(bytes) != -1) { sos.write(bytes); } Problem: ========= 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 192.165.121.101 this should be cached by Apache 192.165.121.101 this should not be cached by Apache Any solution? Thanks in Advance, Govarthanan </pre> |
Recent GIDBlog
2nd Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Apache2 config issues | monev | Apache Web Server Forum | 2 | 28-Jun-2004 06:19 |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 10:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 11:28 |
| Can't view pages from another machine on the Intranet | aevans | Apache Web Server Forum | 9 | 14-May-2004 02:26 |
| [Tutorial] Standard I/O | aaroncohn | C Programming Language | 20 | 27-Feb-2004 21:07 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The