I recently copied the PyServlet code (org.python.util.PyServlet) and used it as the basis for a small Jython-based web framework that sits on top of the Java Servlet spec.  I basically expanded on PyServlet and established several (configurable) conventions allowing simple Python classes to act as "actions," which are mapped to URLs by the servlet framework using the conventions. 

I was surprised at how concise and simple the Jython action code was after having established a very simple framework.  I could very quickly modify the framework to emulate behaviors of various popular web frameworks (return values from actions could be dictionaries, which pass name-value pairs to a templating mechanism (e.g., Turbogears), or member variables of the action classes, and an action class's scope is copied to the local scope of the template (e.g., WebWork, Struts2).  I could write all of my application code in Jython, or write some parts in Java, however I liked.  I could hook up to the various Java templating mechanisms and ORM frameworks, and still decide (for the most part) how much of my code was in Java and how much was in Jython.

I know there is a move on to make Jython capable of running Python-based web frameworks such as Django and Turbogears.  It seems the argument for doing so is that it would increase Jython adoption and use, as companies that have committed over time to Java infrastructures could use these more dynamic, agile frameworks without having to switch out (or adopt new) infrastructures.

I'm thinking, though, that a new framework based on the synergy between Java and Jython would be able to leverage existing Java app server technologies, while keeping things simpler on the Jython side, and could be designed to take advantage of efficiencies possible with a priori knowledge that the framework is running on top of J2EE.  It would also run on the existing Jython language (as it would be coded that way).  It could also serve as a major update/enhancement to PyServlet.  The framework could be its own project, but could feed back into PyServlet, or PyServlet could be pulled out of core Jython (I've always wondered if it should be in there anyway) and this new project could replace it.

Web frameworks seem to be a dime a dozen these days, but the little test framework I made seemed to work very well and be very flexible.  I'm wondering if anyone has any input to this idea, and would like to participate in a new Jython/J2EE web framework.  At the very least, I could flesh out my toy framework a bit and get it into Sourceforge.  Thoughts, suggestions, criticism?


Chris Collier