Return to Snippet

Revision: 10489
at January 2, 2009 10:56 by callmeblessed

Initial Code
/// for example in your controller you write : session.user = "wysmedia" ; 
/// you can retrive the value on grails service using this following way.

import javax.servlet.http.HttpSession
import org.springframework.web.context.request.RequestContextHolder

class SessionStorageService {

  static transactional = false
  static scope = "singleton"

  def setUser(User user) {
    getSession().user = user

  def getUser() {

  private HttpSession getSession() {
    return RequestContextHolder.currentRequestAttributes().getSession()

Initial URL

Initial Description
how to call session from grails service (spring service)

Initial Title
Calling session on Grails Service

Initial Tags
java, groovy

Initial Language