【发布时间】:2016-03-15 06:49:08
【问题描述】:
我有一个 Play Framework 应用程序,2.4 版正在迁移到 2.5,一切就绪!但使用 BodyParser 在我的自定义操作中引发错误,
def isAuthenticatedAsync[A](parser: BodyParser[A])(f: => Long => Request[A] => Future[Result]) = {
Security.Authenticated(userId, onUnauthorized) { user =>
Action.async(parser)(request => f(user)(request))
}
}
使用这个:
def upload = isAuthenticatedAsync(parse.maxLength(5 * 1024 * 1024, parse.multipartFormData)) { userId => request =>
//Logger.info(s"")
request.body match {
case Left(MaxSizeExceeded(length)) => Future(BadRequest(Json.toJson(ResultTemp("Your file is too large, we accept just " + length + " bytes!"))))
case Right(multipartForm) =>
抛出一个错误:
could not find implicit value for parameter mat: akka.stream.Materializer
[错误] def upload = Action.async(parse.maxLength(5 * 1024 * 1024, parse.multipartFormData)) { request =>
【问题讨论】:
标签: scala playframework