开发者

Is it possible to retrieve information stored in an arbitrary grails session?

开发者 https://www.devze.com 2023-01-16 01:47 出处:网络
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

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

精彩评论

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