Retrieve matched route from controller/action

8 views
Skip to first unread message

ase...@gmail.com

unread,
Nov 7, 2017, 9:01:57 PM11/7/17
to Play Framework
Is it possible to retrieve the route that matched 

For e.g. if I have something like this in the routes file

GET /collections/:collection/items/:item myController.go(collection: String, item: String)

I want to be able to get the string "/collections/:collection/items/:item" inside of myController.go

I know its possible to get the actual path via request.uri/request.path . But I'm interested in the generic form of the route for metric reporting and logging reasons.

Igmar Palsenberg

unread,
Nov 9, 2017, 3:22:28 PM11/9/17
to Play Framework
Out of the box : No. You'll have to do the parsing yourself. We delegated this to a method inside of the action composition that was already present.


Igmar 
Reply all
Reply to author
Forward
0 new messages