我有一个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))
}
Run Code Online (Sandbox Code Playgroud)
}
用这个:
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) =>
Run Code Online (Sandbox Code Playgroud)
抛出错误:
could not find implicit value for parameter mat: akka.stream.Materializer
Run Code Online (Sandbox Code Playgroud)
[error] def …