class InstitutionController extends Controller {
def updateInstitution = Action { implicit request =>
{
request.body.asJson.get.validate[GallreyJsonValidationForUpdate].fold(
valid = {
updateInstitution =>
{
Redirect(routes.GalleryController.updateGallreyObject()).flashing("uuid"- >updateInstitution.uuid,"institutionName"->updateInstitution.institutionName,"details"->updateInstitution.details)
}
},
invalid = {
errors =>
{
val json=commonUtils.getResponse(Http.Status.BAD_REQUEST, ServerResponseMessages.VALIDATION_FAILED,JsError.toJson(errors))
log.error("sending error in json{}", json)
BadRequest(json)
}
})
}
}
這就是我重定向到行動不重定向到在遊戲的框架另一個Action
class GalleryController extends Controller {
def updateGallreyObject = Action { implicit request =>
{
val uuid=request.flash.get("uuid")
val institutionName=request.flash.get("institutionName")
val details=request.flash.get("details")
Ok("some details")
}}
}
這裏的行動是捲曲的文件,我使用
contentType="Content-type: application/json";
data='{ "uuid" : "123" , "institutionName" : "abc" , "details" : "some details"
}';
echo " "
echo "------------------ Sending Data ------------------"
echo " "
echo "Content-Type : " $contentType
echo "Data : " $data
echo " "
echo "------------------ Response ------------------"
echo " "
echo " "
curl --include --request POST --header "Content-type: application/json" --data "$data" http://localhost:9000/institution/update
響應我我得到的是
HTTP/1.1 303 See Other
Location: /gallery/update
Set-Cookie: PLAY_FLASH=uuid=123 &institutionName=abc&details=some+details; Path=/; HTTPOnly
Date: Sat, 04 Mar 2017 14:40:29 GMT
Content-Length: 0
這裏是路線
POST /institution/update controllers.InstitutionController.updateInstitution
爲什麼不重定向到updateGallreyObject
操作?我在做什麼錯了,請幫幫忙,我希望它重定向到updateGallreyObject
行動與數據請大家幫忙,我期待這個迴應「某些細節」
更新我已經有了這條路線
POST /gallery/update controllers.GalleryController.updateGallreyObject
我有它已添加它路由文件 – swaheed