I am not sure if I got it right. I want to create a HTTP Session when a request is comming to my REST api. What I did in Grails conf folder is creating a Filter as:
class SessionFilters {
def filters = {
createSession(controller: '*', action: '*') {
before = {
def session = request.getSession(true) //create session if not exists
}
}
showInActionName(action: 'show', find: true) {
before = {
session.currentLocation = request.forwardURI - request.contextPath
}
}
}
}
It works well wir HTTP request meaning if I request a view which is served by a Grails Controller.
But when it comes to REST APi I am not sure I a session is created correctly. I want to create a session because I want to track which users are currently online and logged in.
My question. Is this the correct way of doing this or would you suggest another way?
I am not sure if I got it right. I want to create a HTTP Session when a request is comming to my REST api. What I did in Grails conf folder is creating a Filter as:
It works well wir HTTP request meaning if I request a view which is served by a Grails Controller. But when it comes to REST APi I am not sure I a session is created correctly. I want to create a session because I want to track which users are currently online and logged in.
My question. Is this the correct way of doing this or would you suggest another way?