2009-10-29 3 views
5

Comment créer un mappage d'URL global dans Grails?Création d'un mappage d'URL catch-all Grails

Le Grails suivant UrlMapping ..

class UrlMappings { 
    static mappings = { 
    "/$something"{ 
     controller = "something" 
     action = "something" 
    } 
    } 
} 

.. semble correspondre ^/[^/]* mais comment puis-je créer un UrlMapping correspondant à toutes les URL (^/.*)?

Répondre

14

Vous recherchez le ** "double joker". Exemple:

class UrlMappings { 
     static mappings = { 
     "/**"(controller: "something", action: "something") 
     } 
    } 
+1

Excellent! Une question restante - comment obtenir la chaîne appariée - c'est la valeur de/**? – knorv

+1

J'ai trouvé la réponse: "/ $ quelquechose **" me donne des params.quelquechose - merci! – knorv

+1

Je l'ai fait et maintenant mon quand je vais '/' via 'createLink' mon URL ressemble à' http: // /** ' –

Questions connexes