Hi Paul,
On May 10, 2009, at 10:57 AM, Paul Libbrecht wrote:
And without a request around?
I need this for the indexer... that's getting more trick.
If you mean the lucene indexer then you're inside a daemon thread
which has no request/context/Servlet at all and is not supposed to. So
you cannot and shouldn't access them.
BTW note that if you got access to some request it'll probably be made
invalid pretty soon by the servlet container since the container
generally invalidates it when the request has been processed completely.
The question is: why would you need access to those?
Thanks
-Vincent
I guess I could store the context in the plugin statics if I was
sure a request would use it first but I am rather sure of the
contrary: the indexer will fire first.
Is there a way I can access the servlet-context from some xwiki or
context objects?
thanks in advance
paul
Le 08-avr.-09 à 11:21, Sergiu Dumitriu a écrit :
>> But, erm, dumb question, how can I get the ServletContext?
>> I found how to get the request and response but not the servlets or
>> context yet.
>>
>
> getRequest().getSession().getServletContext()