Michael
Michael

Reputation: 33297

Is it possible to get a List of all active Sessions?

When being in a Grails action I can access a HTTPSession with session.

Is it also possible to get a list of all active sessions?

Upvotes: 4

Views: 1888

Answers (2)

MKB
MKB

Reputation: 7619

You can use getSessionsInfo() method of ScopesInfoService service of Application Info plugin.

First install plugin(in BuildConfig)

compile ":app-info:1.0.2"{
        excludes 'jquery'
}

then make an entry in Config

grails.plugins.appinfo.useContextListener = true

finally inject service and use its getSessionsInfo() method

def scopesInfoService
...
scopesInfoService.getSessionsInfo()

to get the list of all active sessions.

Upvotes: 2

Alidad
Alidad

Reputation: 5538

This is the answer to your question in comments:

I was able to get it work with 2.2.4, without any issue. Make sure you read this blog for compatibilities with grails 2+.

To exclude the jquery version use:

compile (":app-info:1.0.2" ){
            excludes 'jquery'
}

This way your are telling Grails not to use plugins' jquery but your app.

Upvotes: 4

Related Questions