为什么Play Framework中的操作和请求会采用类似参数,如下面的代码所示?
import play.api.mvc._
case class Logging[A](action: Action[A]) extends Action[A] {
def apply(request: Request[A]): Future[SimpleResult] = {
Logger.info("Calling action")
action(request)
}
lazy val parser = action.parser
}
答案 0 :(得分:1)
如果您查看操作文档here
此类型
type BODY_CONTENT = A
Type of the request body.
如果您知道,可以申请
text/plain: String
application/json: JsValue
text/xml: NodeSeq
application/form-url-encoded: Map[String, Seq[String]]
multipart/form-data: MultipartFormData[TemporaryFile]
any other content type: RawBuffer
还可以看一下:身体解析器
https://www.playframework.com/documentation/2.0/ScalaBodyParsers