Gzip

Bandwidth can be wasted when using verbose plaintext formats such as XML, leading
to a poor user experience for your apps.
Fortunately, many clients can accept compressed content and Scalatra lets you
compress server responses without any change to your business logic.
Just mix in ContentEncodingSupport.

See
scalatra-gzip
for a minimal and standalone project containing the example in this guide.

Example

This servlet will reply with compressed content if and only if the client provides
an Accept-Header indicating it understands gzip.