java - Getting http-session from a child thread? -
i'm using spring framework , here's piece of code i'm using retirieve httpsession
object:
servletrequestattributes attr; try { attr = (servletrequestattributes) requestcontextholder .currentrequestattributes(); } catch (exception e) { } httpsession session = attr.getrequest().getsession(false);
the thing requestcontextholder
holder class expose web request in form of thread-bound requestattributes object.
therefore won't seen outside of thread created container handling request. there way retrieve session in child thread?
no there isn't. in servlet api, session property of request object. therefore, if don't have request, of many existing sessions retrieve?
Comments
Post a Comment