Vincent,
the reason is simply that the plugin provides services that are done
by another web-app.
That web-app, in this case, is an index which represents an ontology;
it does have and need its own web-access.
I only store the result of walking from the request, until the actual
other-servlet-context's attribute which can then be stored untill a
restart. I just found another surprising way:
((XWikiServletContext)
context.getEngineContext()).getServletContext()
The cast is potentially dangerous, that's true but it seems to work.
I agree storing requests wouldn't be a good idea.
paul
Le 10-mai-09 à 11:08, Vincent Massol a écrit :
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()
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs