class UserController { def logout = { log.info "User agent: " + request.getHeader("User-Agent") session.invalidate() redirect(action:"login") } def login = { } }
Grails为session对象添加的方法可参考Grails Servlet API。