| <!-- |
| /*************************************************************************************************************************** |
| * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations under the License. |
| ***************************************************************************************************************************/ |
| --> |
| |
| Encoders |
| |
| <p> |
| 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. <l>"gzip"</l>) on requests and responses |
| based on the request <l>Accept-Encoding</l> and <l>Content-Encoding</l> headers. |
| </p> |
| |
| <h5 class='figure'>Example:</h5> |
| <p class='bpcode w800'> |
| <jc>// Servlet with automated support for GZIP compression</jc> |
| <ja>@Rest</ja>(encoders={GzipEncoder.<jk>class</jk>}) |
| <jk>public</jk> MyRestServlet <jk>extends</jk> BasicRestServlet { |
| ... |
| } |
| </p> |
| <p> |
| Juneau defines the following encoders out-of-the-box: |
| </p> |
| <ul class='javatree'> |
| <li class='jac'> |
| {@link oaj.encoders.Encoder} |
| <ul> |
| <li class='jc'> |
| {@link oaj.encoders.GzipEncoder} |
| <li class='jc'> |
| {@link oaj.encoders.IdentityEncoder} |
| </ul> |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='jf'>{@link oajr.RestContext#REST_encoders} |
| </ul> |