I would have preferred to write into the xwiki context if I could. But I have not found a way for a filter to be wired in a way that can get the xwiki context. Would there be one?
The context is created by the Struts Servlet (XWikiAction.java) so it does not exist yet when your filter runs. One solution is to move the xwiki context initialization code from XWikiAction to a filter that runs before your filter. We should do this in the platform ideally since it could be useful. You could create a jira issue about it.
Well, our web.xml actually seems to include such a thing org.xwiki.wysiwyg.server.filter.XWikiContextInitializationFilter but I could not read in the source how its output would be profitable to other filters. (I expected something such as a thread-local). paul