如你所知,玩!在 2.2.0 版本中引入了 Gzip 编码。
不幸的是,在更新项目和更新播放后,它不起作用。
[error] ...\app\Global.scala:4: object filters is not a member of package play
[error] import play.filters.gzip.GzipFilter
[error] ^
[error] ...\app\Global.scala:8: not found: type GzipFilter
[error] object Global extends WithFilters(new GzipFilter) with GlobalSettings {
[error] ^
[error] two errors found
[error] (compile:compile) Compilation failed
即使我创建项目表单控制台它也不起作用play new TEST
。
但是,在C:\play-2.2.0\framework\src\play-filters-helpers\src\main\scala\play\filters\gzip
我同时拥有Gzip.scala
和GzipFilter.scala
。
我的\app\Global.scala
样子是这样的:
import play.api._
import play.api.mvc._
import play.api.mvc.Results._
import play.filters.gzip.GzipFilter
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
object Global extends WithFilters(new GzipFilter) with GlobalSettings {
override def onStart(app: Application) {
Logger.info("Application has started")
}
override def onStop(app: Application) {
Logger.info("Application shutdown")
}
override def onError(request: RequestHeader, ex: Throwable) = Future { InternalServerError("{}") }
override def onBadRequest(request: RequestHeader, error: String) = Future { BadRequest("{}") }
override def onHandlerNotFound(request: RequestHeader) = Future { NotFound("{}") }
}
我究竟做错了什么?有没有人让它工作?