Is there any form to create subdirectories dynamically in playframework?, I was thinking in a common interceptor like spring, but.. how can I do it in play??
Thanks for any help
example.com/event1
example.com/event2
example.com/event3
Is there any form to create subdirectories dynamically in playframework?, I was thinking in a common interceptor like spring, but.. how can I do it in play??
Thanks for any help
example.com/event1
example.com/event2
example.com/event3
Best way, I think, is to use the routes file. Documentation here should be self-explanatory:
http://www.playframework.org/documentation/1.2.2/routes
(see e.g. http://www.playframework.org/documentation/1.2.2/routes#syntax)
You can use the routes file, but be aware that the "name" of the folder must be a key that allows you to find the object. Usually the "key" will related to an entity, and in that case Play provides a Long id as key which is a better choice. After that key you can add some string for SEO-usability purposes.
So your routes would be something like:
example.com/1/event1
example.com/2/event2
example.com/3/event3
(or alternatively)
example.com/event/1
example.com/event/2
example.com/event/3
using a routes file like:
GET /{id}/{name} MyController.getFolder
or
GET /event/{id} MyController.getFolder
There are some questions around here (SO) on how to add the extra text to the path.