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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -