tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: whitespace jsp stripper, gzip encoding
Date Mon, 07 May 2001 16:46:03 GMT

On Mon, 7 May 2001, Matt Jones wrote:

> Hi all,
> This is my first message to this list. I made a mod to
> my copy of in the jsp engine
> that condenses whitespace, making the generated jsp
> code and the html that's sent to the client smaller. I
> think this might be something other people might like,
> and am wondering what I should do to submit it to the
> main branch?

Hi Matt,

The best way to propose new enhancements like this would be to post the
code to the developer list as "diffs" against the current code, as
outlined on the Jakarta web site.

That way, we can all take a look, and it's easy to integrate if accepted.

> Also, I'd like to mod the jsp engine to be able to
> gzip the output if the client accepts it. I think this
> wouldn't be difficult if I better understood the way
> the engine works. I expect the hardest part is to
> determine how to handle different browsers stabily.
> Based on what I've seen in the mod_gzip apache
> threads, it's a little more involved than just
> checking the accept-encoding request header.

A couple of notes on both of these ideas:

* Sometimes, whitespace is significant to the receiver.  Therefore,
  you would at least want to make this configurable.

* Compressing whitespace violates a requirement of the JSP spec:
  "all white space within the body text of a document is not
  significant, but is preserved"  (JSP 1.2 PFD, section 2.3 -- and
  I'm sure it was in previous versions as well).

* Whitespace compression is nearly always done by modems (if your
  users are connected that way) and can easily be done by other
  network components.  Thus, the benefits might not be as great
  as you would expect.

* Both whitespace and GZIP compression seem like good candidates for
  being a Filter (see the Servlet 2.3 spec), rather than being embedded
  in the JSP engine where they cannot process output created by servlets.

* As it happens, Tomcat 4.0 includes an example filter that does
  GZIP compression automatically, if the client indicates that they
  can accept it.

> Thanks,
> -Matt


View raw message