I fixed a Wicket bug today for compressing whitespace in HTML. The wrinkle is that you need to avoid doing that inside <pre> tags, otherwise your code formatting goes all wrong.
You should probably just gzip your responses instead, as it’ll be much more efficient than this, but apparently, someone cares enough to raise a bug report, so I rolled up my sleeves. I mean, how hard can it be to strip out some whitespace?