Mathematica Server Pages
Mathematica Server Pages (MSP) technology is the foundation of webMathematica. It is based on a standard Java technology called servlets. Servlets are special Java programs that run on a web server machine. Typically, support is provided by a separate program called a servlet container (or sometimes a servlet engine), which connects to the web server. Essentially, all modern web servers support servlets natively or through a plug-in servlet container. This includes Apache, Microsoft's IIS and PWS, Netscape Enterprise Server, iPlanet, and application servers (such as IBM WebSphere).
MSP technology allows a site to contain HTML pages that are enhanced by the addition of Mathematica commands. When a request is made for one of these pages, which are called MSP scripts, Mathematica commands are evaluated and the computed result is placed in the page.
MSP scripts contain HTML that is marked up with Mathematica commands. They are easy to write and fit well with HTML development mechanisms such as HTML editors. Here is a sample MSP script.
This is very much standard HTML except for the Mathlet tag. It contains the Mathematica commands that are to be evaluated when the page is requested from the server. Here the input polynomial, referenced by the
Setting up a webMathematica site involves first installing and configuring a server that supports Java servlets. When this is running, the webMathematica tools are then installed on the server. These contain all the material that is necessary to support the site, including the following items.
The core of the webMathematica site is the MSP servlet. It uses the Mathematica session manager, a useful application that maintains a pool of Mathematica sessions that are waiting to be used. When a request is received, the MSP servlet obtains a Mathematica kernel and uses it to process the MSP script. When this is finished, the kernel is returned to the pool and the result returned to the browser. A given Mathematica session is reused many times, which leads to an improvement in performance. This arrangement allows one server to work with more than one Mathematica kernel, allowing concurrent computations.
The Mathematica session manager takes care of launching and initializing Mathematica kernels. It also takes care of shutting down sessions that exceed a preset limit for computations. The whole system is fully configurable to provide detailed control of a particular site.
An overview of the steps in processing a page is shown below. For the sake of illustration, it has a Mathematica session pool with three sessions.
Copyright © 2001 Wolfram Media, Inc. All rights reserved.