Skip to main content

Encoders

The @Rest(encoders) annotation can be used to associate character encoders with a servlet class. Encoders can be used to enable various kinds of compression (e.g. gzip) on requests and responses based on the request Accept-Encoding and Content-Encoding headers.

Example
// Servlet with automated support for GZIP compression
@Rest(encoders={GzipEncoder.class})
public MyRestServlet extends BasicRestServlet {
...
}

Juneau defines the following encoders out-of-the-box:

GzipEncoderIdentityEncoder