You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by NabbleSometimesSucks <bi...@yahoo.com> on 2013/03/20 18:03:32 UTC

How in custom code can we get ServletRequest

OK, so I was implementing a delegatingCache class so that all the calls to
the cache will first check to see if a session object already exists and if
so, don't go to the cache so many times.

I first implemented it with ThreadContext which puts it into ThreadLocal.
However, the calls to the cache is multi-threaded. So ThreadLocal only
reduces the calls a little bit. So I am thinking what about in a Request
context, like the ServletRequest or something.

So there is the WebUtils class that has a static method to get the request
but it takes in a RequestPairSource and well, all it does is call a method
on the object to pass in to return the ServletRequest that was in there in
the first place.

But then how do you get the RequestPairSource, Well the WebSubjectContext
interface extends it, so maybe I can get the WebSubjectContext. But not sure
how.

Anyone know how I can get access to it in my Cache class so that I can
reduce the number of calls.

Thanks

Mark



--
View this message in context: http://shiro-user.582556.n2.nabble.com/How-in-custom-code-can-we-get-ServletRequest-tp7578474.html
Sent from the Shiro User mailing list archive at Nabble.com.