/coffeefilter

Sample project for ServletFilter support

Primary LanguagePythonApache License 2.0Apache-2.0

CoffeeFilter

This is a starter project to play with writing Java servlet filters in Python, using Jython and Clamp.

Start by installing Jython 2.7 from source, due this CLASSPATH bug that's blocking RC3, because it's rather annoying not to have CLASSPATH support for doing this type of development. (The Jython dev guide provides more details.) You just want the developer build you get with just running ant.

Make sure pip and setuptools are installed:

jython -m ensurepip`

then

pip install git+https://github.com/jythontools/clamp.git

(where pip is the one in the same bin directory as Jython!).

Next run

jython setup.py install singlejar

and this will produce a jar you can load as a ServletFilter, using the name coffeefilter.CoffeeFilter. Of course it will do nothing interesting just yet, since the code is as follows:

class CoffeeFilter(ClampedBase, Filter):
    def init(self, filterConfig):
        raise NotImplementedError("implement!")

    def doFilter(self, request, response, chain):
        raise NotImplementedError("implement!")
        
    def destroy(self):
        raise NotImplementedError("implement!")