ModjyDesign
Version 1 (Alan Kennedy, 03/15/2009 09:16 pm)
| 1 | 1 | h1. A design overview of modjy |
|
|---|---|---|---|
| 2 | 1 | ||
| 3 | 1 | h3. Architecture |
|
| 4 | 1 | ||
| 5 | 1 | The architecture of modjy is very simple, from a J2EE point of view. It consists of a single java servlet class, which is a thin wrapper around the required jython functionality. Since the java servlet is multithreaded, only one instance of it will ever run in a given container (unless configured otherwise). This java servlet also initializes the jython runtime, setting some necessary parameters beforehand. |
|
| 6 | 1 | ||
| 7 | 1 | The java servlet then creates a single instance of the jython-implemented *modjy_servlet* class, to which all incoming HTTP requests are delegated. Depending on configuration, modjy_servlet creates 1 or more instances of the jython WSGI application object, as described in [[ModjyLocateCallables|How modjy locates application callable objects]]. It then creates WSGI environment and start_response_callable objects, and invokes the application. |
|
| 8 | 1 | ||
| 9 | 1 | More details on how to configure modjy to use single vs. multi threading, etc, see the [[ModjyConfiguration|Configuration reference]]. |
|
| 10 | 1 | ||
| 11 | 1 | h3. Code structure |
|
| 12 | 1 | ||
| 13 | 1 | The principal jython class for implementation of modjy is the *modjy_servlet* class. This class uses "mixins":http://en.wikipedia.org/wiki/Mixin to "factor out code by functionality":http://www.linuxjournal.com/article/4540, so that the structure can be more easily evolved, components replaced, etc. |
|
| 14 | 1 | ||
| 15 | 1 | Modjy has been updated to work on jython 2.5 and jython 2.2, and will no longer run on jython 2.1. |