Serve Gzipped content with Java Servlets

后端 未结 7 2154
予麋鹿
予麋鹿 2021-01-05 01:40

I was wondering if there was an easy way to serve GZipped content with Java Servlets. I already have the app up and running so the modifications needed should be to

7条回答
  •  不知归路
    2021-01-05 02:08

    Depending on your container, the container will most likely do this for you. It may do it automatically, or you might need to manually configure it to do it for you. The advantage of this method is zero code changes. And, again, depending on container, you can conditionally enable/disable the compression based on where the request comes from or source browser.

    For Tomcat, have a look at the compression attribute on the HTTP config pages (v5.5, v6.0).

提交回复
热议问题