{title:'Encoders', updated:'9.0.0'}

The {@link oajr.annotation.Rest#encoders @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 implements BasicUniversalConfig { | ... | }

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

- {@link oaj.encoders.GzipEncoder}
- {@link oaj.encoders.IdentityEncoder}