Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.3.7, 2.0 final
-
Fix Version/s: None
-
Component/s: URL mappings
-
Labels:None
Description
UrlMapping is a powerful artefact for url routing. However it could be improved to
- Let plugins add custom cases :
"/$controller/$action?" cache:10.minutes "/secured/$controller/$action?" secure:'ROLE_USER'
- GString :
def var = 'repeated-stuff' "/${var}/some/1" controller:'some' "/${var}/sample/2" controller:'sample', action:'wanabeeAction' "/${var}/test/3" controller:'test'
- Redirect/Forward
"/some/old" redirect:[controller:'some'] "/some/old/2" redirect:"/test/2" "/some/old/3" forward:"/test/3"
- REST syntax
post "/some/post" , controller:'test' put "/some/put" , controller:'test' [post,put,get] "/some/rand" , controller : 'test'
- General Routing syntax, and changing UrlMapping artefact to Route artefact
mail from:'*', bean:'myService', method:'bla' amqp topic: 'bla', bean:'myService', method:'bla' event topic: 'afterInsert', bean:'myService', method:'bla' //bla signature : def bla(Domain data)
- Static checking for routes
// warn/error on start/compile "/$controller/sample" action:'doesntExist'
- Static compile for routes : routes could be AST'ed to improve runtime lookup
- Namespacing
admin { "/user"(controller:"user") }
- Default values for namespaces
admin(action:'test',cache:10.minutes) // all routes under admin namespace apply that rules if not overriden
- Assign namespaces for plugins
compile ":weceem:1.0", { namespace "weceem" }
- Event urls (Pluggable behavior)
"/$controller/$action" event:'topic' "/background/$controller/$action" eventAsync:"topic-$controller-$action"
- Push registration / Broadcast (Pluggable behavior)
"/stream/api/$id" suspend:true "/user/save" broadcast:'/stream/api/*'
Issue Links
- relates to
-
GRAILS-8871
@CompileStatic / @TypeChecked compatibility
-
-1 routes, this is just about URLs.
-1 to single plugin scoped namespacing, in the sense it doesn't work for plugins that provide multiple "kinds" of URLs that the app needs to namespace separately
+1 for "default values", some way to set values on url mappings that other plugins can examine i.e. getCurrentURLMapping().metadata('cache') to get cache duration