• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reducing response size  RSS feed

 
Guillaume Bilodeau
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I'm working on a web application in a Servlet 2.2 / JSP 1.1 / Struts 1.0 environment. A current objective is to reduce the size of the HTML pages sent back to the client: right now there seems to be a lot of extra white space that could be removed, and any gain in size would greatly help reduce bandwidth use.
I have tried compressing pages with a GZip stream but without any success. I have extended the Struts ActionServlet class and overridden the process() method to wrap the original response in a GZip-compressed response, but I constantly end up receiving a download dialog on my browser (as if I were sending a zipped file) or getting ClassCastExceptions (with IBM WebSphere classes being expected). I suspect the forward mechanism is the cause to all that, but it could be a coding error too.
Of course, a 2.3 filter would have been the ideal solution, but that is not an option. Has anybody succeeded in GZipping responses by extending the Struts servlet? How did you do this? Are there any other mechanisms that could be used to reduce the size of the generated pages?
Thanks a lot,
Guillaume
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We had a similar problem at one stage, and we found we could reduce the page sizes by 40% by removing the whitespace from the JSPs before they are served. Not a perfect solution, but it enabled us to reduce text downloads to under 20k and page sizes under 40k.
At the same time had minor improvements by introducing style-sheets and making the HTML more efficient through doing things like joining lines and removing tables.
That said, GZIP compression should be supported by the major browsers, I'd have to double check this though.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!