DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5560>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5560 Removal of unnecesary white space in output Summary: Removal of unnecesary white space in output Product: Tomcat 3 Version: 3.3 Final Platform: Other OS/Version: Windows NT/2K Status: NEW Severity: Enhancement Priority: Other Component: Jasper AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hi. I don't know if this kind of stuff should be done in here, but here it is. We use tomcat to serve our portal, and lots of unnecesary white space are served to the browser (line feeds, tabs, spaces), which increases size of pages and thus makes site slow on modems. I modified org.apache.jasper.compiler.CharDataMapper.generateChunk (and MappedCharDataMapper.generateChunk) to remove them at Jasper compilation time. The new method looks like: private void generateChunk(ServletWriter writer, int from, int to) { // Generate the char data: int limit; int lastChar; StringBuffer sb; sb = new StringBuffer(); limit = chars.length; lastChar = 0; for (int i = 0; i < limit; i++) { int ch = chars[i]; switch (ch) { case '"' : sb.append("\\\""); break; case '\\' : sb.append("\\\\"); break; case '\r' : ch = '\n'; case '\n' : if ( '\n' != lastChar ) { sb.append("\\r\\n"); } break; case ' ' : if ( ! isBlank(lastChar) ) { sb.append(" "); } break; case '\t' : if ( ! isBlank(lastChar) ) { sb.append("\\t"); } break; default : sb.append((char) ch); } lastChar = ch; } if ( 0 < sb.length() ) { writer.indent(); writer.print("out.write(\""); writer.print(sb.toString()); writer.print("\");\n"); } } protected static boolean isBlank(int ch) { return (' ' == ch) || ('\t' == ch) || ('\n' == ch); } This reduces our page sizes by 3-4K Just to let you know Thks -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>