一個jetty Gzip壓縮報的錯

來源:互聯網
上載者:User

標籤:

這兩天在弄Gzip壓縮, 伺服器為jetty 版本8.*: 碰到一個困擾我好一段時間的一個問題:

啟用Gzip壓縮後報錯如下:

【java.lang.IllegalStateException: !asyncSupported

at org.eclipse.jetty.server.Request.startAsync(Request.java:2058)
at spray.servlet.Servlet30ConnectorServlet$Responder.<init>(Servlet30ConnectorServlet.scala:89)
at spray.servlet.Servlet30ConnectorServlet.service(Servlet30ConnectorServlet.scala:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)】

 

經曆了各種排查,終於解決:

  在原有的GzipFilter基礎之上添加【async-supported】。修改後的web.xml 中jetty過濾器部分

 1 <!-- Gz壓縮測試 start --> 2     <filter> 3         <filter-name>GzipFilter</filter-name> 4         <async-supported>true</async-supported> 5         <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class> 6         <init-param> 7             <param-name>methods</param-name> 8             <param-value>GET,POST</param-value> 9         </init-param>10         <init-param>11             <param-name>mimeTypes</param-name>12             <param-value>text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,application/json,application/xml,application/xml+xhtml,image/svg+xml,image/gif,image/png,image/jpg</param-value>13         </init-param>14     </filter>15     <filter-mapping>16         <filter-name>GzipFilter</filter-name>17         <url-pattern>/*</url-pattern>18     </filter-mapping> 19     <!-- Gz壓縮測試 end -->

  

  -- 1.  GzipFilter 是可以設定同步非同步;

    2. servlet 也是可以設定同步非同步(這個是利用架構中色servlet);

    3. 注意提高自己,解析報錯,並快速定位問題的能力(他這個報錯以為是servlet 不支援非同步,各種換servlet嘗試);

    4. 如果有其他朋友碰到類似的問題,可以有個協助;對問題的一個記錄.

一個jetty Gzip壓縮報的錯

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.