Hope I can get some insight and suggestion from tomcat developers (like which is the best class to subclass as jython servlet handler; what are the needed instance variables to be passed to jython servlet, etc.). The PyServlet code is available at http://groups.yahoo.com/group/jpython/message/3714 . I believe servlet in jython under tomcat has huge, huge potentials. IMHO JythonServlet vs. JSP is almost like mod_perl vs. mod_php, only that everything's in Java. Appreciate any help, /Brian ----- Original Message ----- From: "Brian Zhou" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, January 31, 2001 9:34 AM Subject: [Jython-users] servlet problem self.getInitParameterNames() under PyServlet wrapper Hello list, Following http://groups.yahoo.com/group/jpython/message/3714 I succeeded making servlet running under PyServlet wrapper/handler on win2k tomcat3.2.1. So far so good, I can run simple script like: import sys, java, javax class hello(javax.servlet.http.HttpServlet): def doGet(self, req, res): res.setContentType("text/html"); out = res.getOutputStream() out.println("""\ <html> <head><title>Hello World</title></head> <body>Hello World! <P> current server time is: %s </P> </body> </html> """ % (java.util.Date())) out.close() return Or even dynamicly generate PNG graph thanks to the new javax.imagio package from Sun. I don't expect any difficulty hooking up with database using JDBC. However, when trying to port SnoopServlet from java to jython, I found that PyServlet really doesn't handover any instant variables to the jython HttpServlet subclass except (request, response). So enum = self.getInitParameterNames() will got a NullPointerException. Any operation involve self.attribute like self.getServletContext() will also fail. I don't think jythonc compiled classes will have this problem because the jython servlet handle service() directly bypassing PyServlet. So my questions are: 1. Am I missing anything? Any misunderstanding of the API? 2. Any way around? Anyone got a better PyServlet? 3. If I'm the first one got bitten, any idea how we may overcome this problem? Seeing the power of dynamic python scripting at work (instant feedback without re-compiling), I really appreciate what have been done so far, and want to get it going. Here are some of my ideas: 1. We can have two seperate subclasses of HttpServlet in java: one possibly named ServletPyHandler, doing what PyServlet currently is doing, dispatching service() calls to jython servlet; the other JyServlet being superclass of all jython servlets, with constructor JyServlet(ServletPyHandler), so JyServlet always has a ref to the ServletPyHandler instance; The downside of this approach is that now jythonc compiled servlet and dynamically interpreted servlet have to be written differently. 2. Have ServletPyHandler do somthing to the jython servlet class right before dispatching service() call, so that inside jython servlet, later when messages like self.getInitParameterNames() will be redirected back to ServletPyHandler. TIA for any ideas, /Brian > > _______________________________________________ > Jython-users mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jython-users > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]