Title: PyFilter: dynamically loaded ServletFilters like PyServlet
Type: rfe Severity: normal
Components: Core Versions:
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: cgroves Nosy List: cgroves, jfeinberg
Priority: normal Keywords: patch

Created on 2007-12-28.01:26:44 by jfeinberg, last changed 2009-06-23.06:19:29 by cgroves.

File name Uploaded Description Edit Remove jfeinberg, 2007-12-28.01:26:44 PyFilter implementation
pyfilter_to_jython.diff cgroves, 2008-01-13.07:22:33 PyFilter moved to org.python.util and PyServlet implements ServletContextListener
msg2976 (view) Author: Jonathan Feinberg (jfeinberg) Date: 2007-12-28.01:26:44
I'm a developer at IBM Research, using and enjoying Jython in my daily work. I immediately got the point of the PyServlet, but was disappointed at the lack of an analogous PyFilter. So I made one. Making it took not terribly long; getting clearance from our Open Source Steering Committee to share it with you all took considerably longer.  

I offer it to you here with the intention that, if the committers like it, it may be modified to suit your preferences and added to the Jython distribution alongside PyServlet. On the other hand, if you'd prefer that it be made available separately, as a third-party contribution, I'd be happy to do that, too.  

It depends on the presence of PyServlet. If you did think it worthwhile to include in the core distro, I'd recommend factoring out the interpreter bootstrapping that's currently in PyServlet's init() method into a ServletContextListener that both PyServlet and PyFilter could require. I'd be happy to do the work myself if invited, but would have to jump through considerable IBM hoops to get permission to do so. So, for now, here's the work. What should I do next?
msg2977 (view) Author: Charlie Groves (cgroves) Date: 2008-01-13.07:22:33
File Added: pyfilter_to_jython.diff
msg2978 (view) Author: Charlie Groves (cgroves) Date: 2008-01-13.07:30:29
pyfilter_to_jython.diff modifies the attached PyFilter by moving into org.python.util and ripping out the logging stuff that isn't available in Jython.  The filtering code seems to work as advertised, so that's all set.

It also makes PyServlet a ServletContextListener so the initting can be done without making a servlet out of PyServlet without actually using it.  I did it that way rather than making a separate class for the context listener so PyServlet will init itself if used without a listener and allow existing code to continue running.  I don't particularly like making PyServlet both an HttpServlet and a ServletContextListener, so I'm planning on revisiting this before actually committing it.
msg4853 (view) Author: Charlie Groves (cgroves) Date: 2009-06-23.06:19:28
Added in r6492 and r 6496.  Thanks!
Date User Action Args
2009-06-23 06:19:29cgrovessetstatus: open -> closed
resolution: accepted
messages: + msg4853
2009-06-22 06:18:03cgrovessetassignee: cgroves
2009-03-12 06:50:33zyasoftsettype: rfe
2008-12-15 16:00:05fwierzbickisetcomponents: + Core, - None
2007-12-28 01:26:44jfeinbergcreate