Download TEAM LinG - LinuxTone.Org

Transcript
Chapter 22
Figure 22-2
Once you have an application server such as Tomcat running, the next step is to deploy an application —
in this case, a special Python servlet called PyServlet.
Adding the PyServlet to an Application Server
Jython includes a class called org.python.util.PyServlet that acts as a front end for Python scripts.
The PyServlet class will load Python scripts, compile these scripts, and then execute the scripts as if
they were Java servlets (which, in fact, they are, as shown in the section “Extending HttpServlet,”
following).
To make all this magic work, though, you need to create a bona fide J2EE Web application. Luckily, this
isn’t that hard. Change to the directory in which you installed Tomcat and run the following commands,
which create directories:
$ cd webapps
$ mkdir jython
This command creates a directory under webapps with the name of jython. This means the name of our
Web application will be jython:
$ mkdir webapps/jython/WEB-INF
560
TEAM LinG