Gzipフィルタを使って更にレスポンスの高速化を行ってみます。
project/plugins.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")
build.sbt
pipelineStages := Seq(rjs, digest, gzip) libraryDependencies += filters
app/Global.java
import play.filters.gzip.GzipFilter; public class Global extends GlobalSettings { /** * Get the filters that should be used to handle each request. */ @SuppressWarnings("unchecked") public <T extends EssentialFilter> Class<T>[] filters() { return new Class[] { GzipFilter.class, HTMLCompressorFilter.class}; } }
適用前後でレスポンスヘッダーが次のように変わります。
Content-Length 602 Content-Type text/html; charset=utf-8
が
Content-Encoding gzip Content-Length 302 Content-Type text/html; charset=utf-8 Vary Accept-Encoding