This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Well, it's probably easiest to install a zip utility (like modgzip for Apache) on your web server so that all of your content is zipped regardless of its origin... You could do what you're doing in Servlets in a JSP, too, but the other option is probably far easier. Kyle
Hi, I used this code in my program. but when i used GZipOutputStream. It displayed the download box on the client machine. Plz help me how to send the fast output to the client. Thanks in advance, Rajesh
Hi Michael, I think Kyle suggestion is the best. However if you don't/can't use Apache as a web front end, have a look at your web/application server console to see if your can enable this behaviour. If not, depending on the version of servlet engine you're using, you might be able to use a Filter servlet to do the compression. This provides better encapsulation of the feature. Anyway, before performing gzip compression, you must ensure the client web browser supports the gzip compression. Try to find the word gzip in the Accept-Encoding line in the request headers. If found, the client accepts gzip. In that case, you can compress your output using the GZIPOutputStream, but do not forget to tell the client you are sending him a compressed stream by setting gzip in the Content-Encoding line of the server's response header. Cheers
Joined: Dec 05, 2000
Thanks a lot for your guys' reply. Do you know where can I download modgzip? Is it free? I tried to search it in google, but, it seems I counldn't download it anymore. I have another question, if my jsps contain lots of gif, will modgzip put all the images in one zip file at the same time? Cheers! Michael