With the caveat that, as only one member of the XWiki community and (not even a developer), I have no special authority to pronounce what is "the preferred way" for doing this, but as one who has implemented a servlet filter with XWiki I will give what I see as some of the major parameters of your decision. One major consideration is whether your logging depends on any XWiki context information, or only on the content of the form. The action servlet builds a great deal of context before actually paying attention to the form content. This, it turns out, is not difficult to duplicate, but you do have the risk that this will change with later versions. It's not clear to me whether it's intended to be an officially supported API, and thus guaranteed not to change; I can tell you that it does not appear to have changed between the 0.9.840 version and 1.0, because my servlet filter that does this works on both. Another important issue is whether you actually want this to happen before XWiki attempts to deal with the form entry. If the filter were to log data that would be invalidated if the request failed, you would then have to undo it, which would be harder (or impossible, depending on the logging mechanism), though logging the subsequent failure should be acceptable. If the HTTP requests and responses contain all the information you require, consider the AWStats package (http://awstats.sourceforge.net/). It provides a great deal of information merely by looking at HTTP server logs, and it may be easily extensible to handle forms data. Of course, being an open-source project, I know it's extensible; the question is how easily. brain[sic]
-----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Saturday, April 28, 2007 3:49 AM To: [email protected] Subject: [xwiki-users] On using servlet filters
Hi
This query is in addition to a query I had posted some time before.
When a document [of a particular type - which follows a particular template] is edited and submitted, or newly created, I want to log the IP address of the user plus some of the values of certain fields in that form.
One reply I got was to use servlet filters? I tried using servlet filters and I found that it is possible.
My doubts are :
Is Servlet filters the preferred way for doing what I require in XWiki? Is there any other ways to do the same in xwiki?
If Servlet filter is the way, then is there any preferred way to use in xwiki? (What I did was to place the servlets in WEB_INF/classes folder and added the entry in web.xml.)
Regards Roopesh