开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜