I have this in my routes.conf file:
# SecureSocial routes
# Login page
GET /login securesocial.controllers.LoginPage.login
And then I have this in a Scala Controller file
val index = SecuredAction { implicit request =>
Redirect(routes.UserOps.watchlist)
// how do I go straight to /login? >|
}
Doing this takes me to a login page that has a red error bar saying "you must be signed in to view this page". If I access `localhost:9000/login' I get the login page without the error bar.
Normally I do a Redirect(routes.SomeControllerObject.ActionMethodName)
but in this case the controller I need to access is in a plugin...
I feel like I'm missing something rather large here...
Update:
To reverse-route to an action in a plugin controller you need to provide the correct, full path to the plugin's routes
class.
Redirect(securesocial.controllers.routes.LoginPage.login)
Original Answer
For reverse-routing I don't think it matters where the Controller
is since Play is building that when the project compiles. From the documentation:
For each controller used in the routes file, the router will generate a ‘reverse controller’ in the
routes
package, having the same action methods, with the same signature, but returning aplay.api.mvc.Call
instead of aplay.api.mvc.Action
.
So this should work just as if LoginPage
was a controller directly in your app.
Redirect(routes.LoginPage.login);