Include uri-reference when calling controller methods
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
play framework | Status tracked in 1.0 | |||||
1.0 |
Fix Released
|
Undecided
|
Unassigned | |||
1.1 |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
Sometimes when you want to redirect to other controller usually you
just call the controller method. Example:
public static void someMethod() {
// code...
// redirect
OtherController
}
Ok. That's fantastic. However sometimes I would like to be able to
redirect to a URL with a uri-reference. Example: http://
The only way to do that is to use Router.reverse directly and concatenate the url with "#my-uri-
Map<String....> paramsMap ....
paramsMap.
redirect(
So that's a pain. And you miss the compile-time check for the class, method and params. I suggest some way of setting a uri-reference. For example:
uriReference = "my-uri-reference";
OtherController
Where "uriReference" is a static field of the Controller class.
Try with:
package controllers;
import play.mvc.*;
import play.mvc.Router.*;
public class Application extends Controller {
public static void index() {
ActionDefiniti on action = reverse(); {
show( id);
renderText( "Redirecting to %s", action. addRef( "boo")) ;
Long id = 9L;
}
}
public static void show(Long id) {
//
}
}