乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Spring Boot 啟用Gzip壓縮

       昵稱53689559 2018-03-20

      兩點(diǎn)需要注意

      1、需要在application.properties里啟用壓縮,并設(shè)置壓縮支持的格式(默認(rèn)支持text/html等,但不支持application/json)

      server.compression.enabled=true
      server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain

      2、默認(rèn)情況下,僅會壓縮2048字節(jié)以上的內(nèi)容

      #默認(rèn)就是2048 byte
      server.compression.min-response-size=2048

       

      以上內(nèi)容,詳見 org.springframework.boot.context.embedded.Compression

      以及 org.springframework.boot.autoconfigure.web.ServerProperties

       

      另外,這個設(shè)置本身是由servlet container提供的,所以,也可以在tomcat等的設(shè)置里找到。

      對tomcat來說,在server.xml 的HTTP/1.1的connector節(jié)點(diǎn)中設(shè)置:

      復(fù)制代碼
      <!-- 這里的壓縮設(shè)置,是默認(rèn)的 -->
      <Connector port="8888" protocol="HTTP/1.1" 
                     connectionTimeout="21000" 
                     redirectPort="28080" 
                     URIEncoding="UTF-8"
                     compression="on"  
                     compressionMinSize="50"
                     noCompressionUserAgents="gozilla, traviata"  
                     compressionMinSize = “2048”
                     compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" />
      復(fù)制代碼

       

      ps:以上是對于最新的Spring Boot來說的,如果是舊版本的(

       

      參考:

      Spring 官方指導(dǎo)

      使用Tomcat的gzip功能(壓縮請求)

      tomcat配置gzip壓縮compressionMinSize選項無效

      Understanding Gzip Compression in Spring Boot ,Angular Java Application

       

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多