From: Andrew B. <ab...@fa...> - 2001-06-19 16:14:47
|
> Does anyone have experience running Jython in a WebLogic > environment? I think the most likely scenario for us would > be to invoke Jython scripts from within servlets, and then > invoke further Java APIs from within those Jython scripts. A little bit of experimentation with org.python.util.PyServlet has me pretty excited - it seems very easy to configure so you can load your own python scripts (implementing HttpServlet) directly from your webapp's HTML root directory. The scripts can then load java classes from your webapp. I haven't tried it in WebLogic, but the configuration is very simple and should work in any Servlet 2.2-compliant container. In this model, the Jython script *is* the servlet, but it's pretty close to what you described... It seems like python servlets can even import other non-servlet python classes from the HTML root, but it's a little awkward, since they need to be imported by full package name, and the directory with the scripts in it must have an __init__.py in it for the import to work. Not worth complaining about, but it was a little tough to figure out... is there an easier way? Ideally, you'd be able to stick a few python files, including the servlet script, in some random directory under the web app; you'd invoke the jython servlet by its full name, but have the servlet be able to directly import other scripts in the same directory without needing to reference the name of the directory they're in. Seems like jython scripts could easily coexist with JSPs, placing objects in the request context and then forwarding to a JSP to do the presentation. I imagine it could integrate very nicely with Jakarta Struts, too - Python seems like a good language to implement Action classes in. Andy Boyko ab...@fa... |