GZIP PlayFramework 2.0中的响应正文 [英] GZIP the response body in PlayFramework 2.0
本文介绍了GZIP PlayFramework 2.0中的响应正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Playframework 2.x应用程序.我的应用程序中的控制器将JSON响应返回到浏览器/端点.我想知道是否有一种简单的方法来启用响应主体的GZIP压缩.
I am working on Playframework 2.x application. The controllers in my application return JSON response back to the browser/endpoint. I wanted to know if there is a simple way to enable GZIP compression of the response bodies.
推荐答案
gzip'ing是使用Apache前端的完整蛋糕.
gzip'ing is pretty much complete cake with an Apache front end.
在Apache 2.4上,通过Location
块使用一组基本的内容类型来处理gzip可能看起来像这样:
On Apache 2.4 gzip handling via Location
block using a basic set of content types might look like:
<Location />
...
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
SetOutputFilter DEFLATE
</Location>
这篇关于GZIP PlayFramework 2.0中的响应正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文