Grails
  1. Grails
  2. GRAILS-8667

Update UrlMapping : extensions points - syntax - results

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major 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

          Activity

          Hide
          Marc Palmer added a comment -

          -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

          Show
          Marc Palmer added a comment - -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
          Hide
          cdeszaq added a comment -

          Break these out into their own issues. Then they can be voted on individually. Not all of them are equally useful.

          Show
          cdeszaq added a comment - Break these out into their own issues. Then they can be voted on individually. Not all of them are equally useful.
          Hide
          Peter Ledbrook added a comment -

          +1 to breaking these out and also comparing against other URL mapping issues. Some of these may already be in the system. We can track all of them through the URL mappings JIRA component.

          -1 to routes (in agreement with Marc).

          Show
          Peter Ledbrook added a comment - +1 to breaking these out and also comparing against other URL mapping issues. Some of these may already be in the system. We can track all of them through the URL mappings JIRA component. -1 to routes (in agreement with Marc).

            People

            • Assignee:
              Unassigned
              Reporter:
              Stéphane Maldini
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Development