krasserm / grails-jaxrs

JAX-RS Plugin for Grails
http://code.google.com/p/grails-jaxrs/
Apache License 2.0
50 stars 48 forks source link

HTTP Session while Request #55

Closed confile closed 8 years ago

confile commented 10 years ago

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?

budjb commented 8 years ago

This issue was moved to budjb/grails-jaxrs#17