<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # RESTEasy – 啟用 Gzip 壓縮內容編碼 > 原文: [https://howtodoinjava.com/resteasy/enable-gzip-compression-content-encoding-in-resteasy/](https://howtodoinjava.com/resteasy/enable-gzip-compression-content-encoding-in-resteasy/) [**JAX-RS Resteasy**](//howtodoinjava.com/restful-web-service/ "RESTful Web services Tutorials") 具有自動 [**GZIP**](https://en.wikipedia.org/wiki/Gzip "gzip") 壓縮支持。 如果[**客戶端框架**](//howtodoinjava.com/resteasy/resteasy-client-for-consuming-rest-apis/ "RESTEasy client for consuming REST APIs")或 JAX-RS 服務接收到具有“gzip”內容編碼的消息正文,它將自動對其進行解壓縮。 客戶端框架自動將`Accept-Encoding`標頭設置為“`gzip, deflate`”。 因此,您不必自己設置此標頭。 要使用 gzip 壓縮,請按以下方式使用[`@GZIP`](http://docs.jboss.org/resteasy/docs/2.0.0.GA/userguide/html/gzip.html "gzip")注解。 ```java //Output compression @GET @Path("/users") @GZIP @Produces("application/xml") public Users getAllUsers() { //more code.... } //OR //Input compression @POST @Path("/users") @Consumes("application/vnd.com.demo.user-management.user+xml;charset=UTF-8;version=1") public Response createUser(@GZIP User user, @DefaultValue("false") @QueryParam("allow-admin") boolean allowAdmin) throws URISyntaxException { //More code... } ``` ## 用法示例 在上面的 GET REST API 上調用時,沒有 gzip 壓縮的示例 API 輸出**將如下所示:** ```java Date: Sat, 03 Aug 2013 06:18:41 GMT Server: Apache-Coyote/1.1 Content-Length: 277 Content-Type: application/vnd.com.demo.user-management.users+xml;version="1";charset=UTF-8 ``` ![RESTEasy example without gzip compression](https://img.kancloud.cn/05/6e/056e5ba6d88bdbe10676ad9beb82d383_722x352.png "RESTEasy example without gzip compression") 不帶 gzip 壓縮得 RESTEasy 示例 使用`@GZIP`注解進行 gzip 壓縮的示例 API 輸出 ```java Date: Sat, 03 Aug 2013 06:31:21 GMT Content-Encoding: gzip Server: Apache-Coyote/1.1 Content-Length: 165 Content-Type: application/vnd.com.demo.user-management.users+xml;version="1";charset=UTF-8 ``` ![RESTEasy example with gzip compression](https://img.kancloud.cn/ff/91/ff918d91bb0d7cfa95650e799f6591bf_845x372.png "RESTEasy example with gzip compression") 帶有 gzip 壓縮的 RESTEasy 示例 給我留言,帖子中還不清楚。 **祝您學習愉快!**
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看