I need to store some serverside values against a suspended request and I'm not sure how I should go about it. I'd like the attributes to be cleaned up when the suspended connection is no longer live on the client. I expected AtmosphereResource
to have setAttribute(name,value)
and getAttribute(name)
methods but they don't exist. I've thought of three possible approaches:
AtmosphereResource.getRequest().setAttribute(name,value)
AtmosphereResource
implementation and add the methods there (backed by a concurrent map).AtmosphereResource.uuid()
.Questions:
AtmosphereResource
implementation?AtmosphereResource
implementation, will it live for the lifetime of the suspended request? Will this work for all transport methods (eg long-polling)?AtmosphereInterceptor
but can only see inspect
and postInspect
events.I ended up solving my problem with a AtmosphereResourceEventListener
which creates and destroys a session per AtmosphereResource
.
I'm surprised that other people haven't had this problem, it seems like a pretty normal requirement to want a session per client connection.
If anyone is interested in my solution, some interesting classes are: