Open torenedre opened 7 years ago
@ghtore I agree, this bug was introduced when non-static methods support was added to Play framework.
But I personally think that the "implicit redirect" is actually an evil feature of Play framework. I would like to disable this feature at all. At least, we disabled it in our project (and all other Play enhancers).
That's why I personally don't want to waste time on fixing this bug. Sorry. :)
@asolntsev Fine by me, but at least the documentation should be updated to point out the difference between static and non-static methods when it comes to action chaining.
Play Framework v1.4.2 added support for non-static controller methods (https://play.lighthouseapp.com/projects/57987/tickets/1934).
If we have two public non-static methods, and the first method calls the other, this does not trigger a redirect to the client. Instead, the second method is invoked directly by the first.
As a side-effect, Play tries to render a template corresponding to the first method instead of the second one, since we get the error message: The template Application/first.html does not exist.
A work-around is to explicitly do a redirect with
redirect("Application.second");
However, Play developers are used to the redirect-behavior when one controller-method calls another (See Action chaining) They may think that they can just remove the static keyword when upgrading to v1.4.2 or higher, but in fact they can't since this is not completely backwards-compatible.
Note that the same thing happens if the first method is non-static and the second is static.
Environment used: Play 1.4.4 and Java 1.8