|
From: <bc...@wo...> - 2001-02-19 14:29:33
|
[Jaroslav Gergic]
>Thank you Robert and all, now all is working fine...
>
>... and I have another one question for you:
>What exactly (from the servlet programers point of view)
>do following lines (PyServlet.init())?
From the servlet programers POV its just a bit magic that can be ignored
by everyone.
> Can something be wrong with the following lines?:
> ---from PyServlet---
> PySystemState sys = Py.getSystemState();
> sys.add_package("javax.servlet");
> sys.add_package("javax.servlet.http");
> sys.add_package("javax.servlet.jsp");
> sys.add_package("javax.servlet.jsp.tagext");
> ---end---
>
>I was tracing the source code until PackageManager.makeJavaPackage(),
>but I was completely lost there ;)
Lets step away from the implementation for a while.
A problem that Jython have to solve one way or another, is to detect
that some name (say "javax") is a java package. The java API for this
did not exists in JDK1.1 and even in JDK1.2 the support weak. So Jython
tries to scan all the .jar and .zip files that it can find and from the
class names of the classes found calculates that "javax" must be a java
package. In JPython-1.0.X the standard java package names was listed in
the registry and *any* non-standard package name (like "org.mycompany")
had to be added to the package database manually. The sys.add_package
was one such way of manually telling Jython of a known java package
name.
Today the only situation where it is required to call sys.add_package is
when the a jar file is loaded by an alternative classloader, which is
the case of the servlet.jar file under tomcat 4.0m5.
regards,
finn
|