How to iterate routes in a playframework 2 scala app?

What is equivalent for play.mvc.Router.routes in playframework 2 scala?

In playframework 1.x, I could iterate over the available routes in the controller:

for(Route route:Router.routes){
    ...
}

How can I do this with playframework 2 scala?

The dev mode pattern not found seems to be able to iterate over them, but I need to do this in the controller.

+3
source share
1 answer

You cannot do this with Play 2.0.

Routes are defined as PartialFunction[RequestHeader, Handler], there is no way to find out the domain of this function.

, , : Play 2.0 documentation, HTTP- (GET, PUT ..), , , , conf/routes.

Routes, Play , :

for {
  routes <- play.api.Play.current.routes.toList
  (method, pattern, call) <- routes.documentation
} yield {
}
+8

All Articles