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