Is it possible to retrieve information stored in an arbitrary grails session?
Given a sessionid, is it possible to retrieve that information from wherever the ses开发者_开发知识库sion data is stored, or do I have to store the information I want in a database, and retrieve based on the sessionid?
In earlier version of the servlet spec there was a way to get all sessions but it was removed as a security risk. You can register an implementation of HttpSessionListener in web.xml (run grails install-templates
and edit src/templates/war/web.xml to register it) and keep track of sessions that way.
The App-Info plugin has this as a feature (among others). It's disabled by default but easily enabled by adding grails.plugins.appinfo.useContextListener = true
to grails-app/conf/Config.groovy
精彩评论