Hi guys,I am back with my new blog post.

As some times we have scenario to map specific URL

for example “www.myexample.com/someusername”

we can do this mapping easily

'$_username'{

controller= "profile"

action= "show"

}

but the issue is now every hit on www.myexample.com/someurl will be eligible for that url mapping, and for example if we will try to open “www.myexample.com/login” it will also take us to show action of profile controller

Now lets do some magic with constraints for above mapping


'$_username'{

constraints{

//custom validator for the url

_username(validator: { !(it in ['logout','login'])

// Now hits like "/login" or "/logout" will redirect to login or logout controller and any other hit will be redirected

//to show action of profile controller

})

}

controller= "profile"

action= "show"

}