In grails how to insert additional parameters (from session) in all url's

Posted by HeDinges on Stack Overflow See other posts from Stack Overflow or by HeDinges
Published on 2010-03-28T20:16:47Z Indexed on 2010/03/28 20:23 UTC
Read the original article Hit count: 222

Filed under:

I would like to add an additional parameter in my url, the use case is the following:

When user do their login they also specify a 'company' name and from that moment on, all urls should map to:

 /$company/$controller/$action/$id

The main idea is to have the current company name available in all url's, have it bookmarkable, and not to have to pass the company name everywhere as a request parameter.

Also, once users are logged in it is acceptable to have the chosen company name in session scope.

What is the right way of inserting this parameter in all our urls? I tried to modify my UrlMappings mapping, but I didn't found a way to insert the company name.

Thanks,

© Stack Overflow or respective owner

Related posts about grails