Jetty/Feature/GZIP Compression

From Eclipsepedia

< Jetty‎ | Feature
Jump to: navigation, search



Contents

Introduction

GZIP Compression can be used to reduce the amount of data being sent "over the wire". Compression is applied as a transport encoding. This can greatly improve webapplication performance, however it can also consume more CPU and some content (e.g. images) cannot be well compressed.

Feature

Static Content

The Jetty DefaultServlet can serve pre-compressed static content as a transport encoding and avoid the expense of on-the-fly compression. If the "gzip" init parameter is set to true, then Jetty will look for compressed static resources. So if a request for "foo.txt" is received and the file "foo.txt.gz" exists, then it will be served as "foo.txt" with a gzip transport encoding.

GzipFilter

The Jetty GzipFilter is a compression filter that can be applied to almost any dynamic resource (servlet). It fixes many of the bugs in commonly available compression filters (eg handles all ways that content length may be set) and has been testing with Jetty continuations and suspending requests.

Some user-agents may be excluded from compression, so as to avoid some common browser bugs (yes this means IE!).