I'm using Play Framework v2.2.2 (scala) and trying to do a Redirect with a 400 (Bad Request) status.
Currently I'm doing redirects using reverse routing like so:
Redirect(Games.Controllers.routes.SportViewController.show)
I'd like to be able to specify the status of the redirect. I tried adding an additional argument to the call, but I get a compile error of:
Overloaded method value [Redirect] cannot be applied to (play.api.mvc.Call, Int)
In the documentation I noticed you can specify a string uri with a redirect status, however, I would really like to continue using reverse routing in my code instead of having string uri values all over the place.
Redirect("redirect/path", status = 400)
Any ideas or suggestions as how I can accomplish a Bad Request (400) redirect using reverse routing? Is there something I missed in the documentation? Is there a completely different/better way of doing this?
Thanks a bunch!
EDIT
To give a bit more context as to why I asked about the redirect with a specific status. I'm processing a form post. On a successful post (eg. user posted data is valid), then redirect to route X, and on unsuccessful post (eg. user data is missing or invalid), then redirect to route Y. On unsuccessful posts, what status code should be used?