In Build.scala, just add "filters" to your app dependencies
val appDependencies = Seq(
jdbc, cache, filters, ...
)
or, if you are doing it with build.sbt
libraryDependencies ++= Seq(
jdbc, cache, filters, ...
)
Pergunta
As you know, play! introduced Gzip encoding in 2.2.0 version.
Unfortunately, after updating project and updating play, it doesn't work.
[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
It doesn't work even if I create project form console play new TEST
.
However in C:\play-2.2.0\framework\src\play-filters-helpers\src\main\scala\play\filters\gzip
I have both Gzip.scala
and GzipFilter.scala
.
My \app\Global.scala
looks like that:
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("{}") }
}
What am I doing wrong? Has anyone made that working?
Solução
In Build.scala, just add "filters" to your app dependencies
val appDependencies = Seq(
jdbc, cache, filters, ...
)
or, if you are doing it with build.sbt
libraryDependencies ++= Seq(
jdbc, cache, filters, ...
)