The Session Map is available in Grails in the Views, TagLibs and the Controllers. That is, it can be directly accessed by the name “session”. If the Session Map is required to be accessed in the Service Layer or the Domain layer, such a straightforward approach will not work. In this case, a class which is a part of the Spring Framework can be used which gives the current context, the request attributes and the session. This class along with HttpSession have to be imported by issuing the following statements.
Now, the session variable can be defined in the Service class or Domain method as:
def session = RequestContextHolder.currentRequestAttributes().getSession()
The session attributes can now be accessed as
Hope this helps.
S Vivek Krishna