ich habe zwei Aktionen in verschiedenen Controllern ActionA
und ActionB Ich rufe ActionB
in ActionA und ich möchte seine (ActionB) Antwort in ActionA ist es möglich? Wie kann ich diese achive bitte hier helfen, meinen Code istWie bekomme ich die Antwort der aufgerufenen Aktion innerhalb einer Aktion im Spiel-Framework
class ControllerA extends Controller{
def ActionA = Action { implicit request =>
var jsonRequest = request.body.asJson.get
val uuid = (jsonRequest \ "uuid").as[String]
log.info("in ActionA" + uuid)
val controllerB= new ControllerB
val actionB=controllerB.ActionB.apply(request)
//here i want to get the response of ActionB and return this response as the response of ActionA whether its OK or InternelServerError
Ok("i want to show the response of ActionB")
}
}
class ControllerB extends Controller{
def ActionB = Action { implicit request =>
var jsonRequest = request.body.asJson.get
val uuid = (jsonRequest \ "uuid").as[String]
log.info("in ActionB " + uuid)
try {
Ok("i am ActionB with id {}"+uuid)
} catch {
case e: Exception =>
log.error("Exception ", e)
val status = Http.Status.INTERNAL_SERVER_ERROR
InternalServerError(Json.obj("status" -> status, "msg" -> ServerResponseMessages.INTERNAL_SERVER_ERROR))
}
}
}
bitte
Vielen Dank – swaheed