Site Configuration
This section summarizes how to configure a webMathematica site. Most configuration information is held in the file MSPConfiguration.xml. The contents of this file are used to initialize the server and individual Mathematica kernels.
MSPConfiguration.xml
MSPConfiguration.xml is the central configuration file for webMathematica. A sample file is shown below.
<MSPConfiguration>
<KernelPool>
<KernelPoolName>General</KernelPoolName>
<KernelExecutable>D:\Mathematica\MathKernel.exe</KernelExecutable>
<KernelNumber>1</KernelNumber>
<URLPattern>/*</URLPattern>
</KernelPool>
</MSPConfiguration>
This shows the configuration for a kernel pool called General. A kernel pool is a group of Mathematica kernels that can be specially configured and is documented in the Advanced Topics: Multiple Kernel Pools section. You need to have at least one pool; webMathematica comes with a pool called General configured by default.
If you want to change some configuration information, for example, adding some code for the kernel to run when it is launched, you could add this to the configuration file. If you put it inside the KernelPool section, then the change will only apply to that pool. An example is shown below.
<MSPConfiguration>
<KernelPool>
...
<KernelInitializeCode>LoadPackage[]</KernelInitializeCode>
</KernelPool>
</MSPConfiguration>
However, if you want to make the change apply to any pool then you can put the code outside all the pools. This is shown in the following.
<MSPConfiguration>
<KernelInitializeCode>LoadPackage[]</KernelInitializeCode>
<KernelPool>
...
</KernelPool>
</MSPConfiguration>
If you are not sure what to do, then add the changes inside the pool definition.
The different configuration parameters are shown in the tables below.
KernelExecutable | the path to the kernel executable |
KernelLaunchFlags | flags to use when the kernel is launched |
KernelNumber | the number of kernels in a pool |
KernelTimeLimit | the maximum time for each computation |
KernelAcquireLimit | the number of requests a kernel can serve |
KernelConnectLimit | the length of time for the kernel to wait to connect |
KernelInitializeCode | Mathematica code to run during kernel startup |
KernelDestroyCode | Mathematica code to run during kernel shutdown |
KernelAcquireCode | Mathematica code to run when a kernel is acquired |
KernelReleaseCode | Mathematica code to run when a kernel is released |
KernelBaseMemoryLimit | memory limit for continuous usage |
KernelPeakMemoryLimit | memory limit for temporary usage |
FrontEndExecutable | the path to the front end executable |
FrontEndLaunchFlags | flags to use when the front end is launched |
KeepFrontEndAlive | whether the front end should be kept running after usage |
KernelPool | configuration section for a particular kernel pool |
KernelPoolName | the name of a kernel pool |
URLPattern | the pattern to map URLs to a kernel pool |
SecurityConfigurationFile | the name of the security configuration file ToExpression |
CheckToExpression | whether a security check should be applied to ToExpression |
CollectStreams | whether streams opened during a request should be automatically closed |
FileUploadSizeLimit | the limit on the size of files that can be uploaded |
JLinkNativeLibraryDirectory | the location of the J/Link native library |
Logging System
The logging system for webMathematica can be customized. This is described in the Logging section.
Security Configuration
The security system for webMathematica can be customized. This is described in the Security section.
X Server Configuration
Special configuration is often required to allow the front end to connect an X server. This is described in the Installation section under Configuring for the X Window System (Unix only). This is only an issue for running webMathematica under Unix.