Terminating SPWS and releasing media

Once user has finished working with site SPWS serves, there is a need to free resources taken by SPWS. Typically SPWS is two processes named "perl" or "wperl.exe" in process list. They of course won't use CPU cycles when user doesn't make requests to pages served by SPWS, but if SPWS was started from CDROM, then on operating systems other then Windows (i.e. MacOSX and unix-like) user will be unable to eject CDROM unless SPWS is stopped.

In order to stop SPWS, user must access any resource on the site with the path containing string "spws-terminate-and-release-cd" (e.g. filename of the resource should contain this string, or name of directory, or even virtual URL handled by Mason). Once request to this resource is performed, SPWS will continue to serve content for additional 5 seconds (to allow that resource to refer to any other content like scripts, stylesheets, images or even multimedia), and then SPWS will terminate, attempting to eject CDROM if it was started from CDROM.

The sample of this functionality is available on demo cdrom.