Web Application Server
As noted previously, SST implements the Sun Servlet API specification and also provides a servlet container for deploying servlet applications. Where the SST implementation is incomplete, API is present and marked as "not implemented".
The Servlet API formalizes the definition of a "web application", and expresses this definition in terms of a deployment descriptor DTD. A formal definition such as this facilitates the implementation of application-neutral servlet containers, development tools, and deployment tools.
SST models this DTD with its SstWebAppSpecification. SST provides a small example web application, by way of illustrating some features of the API and the techniques for building and deploying a web application. The specification for this example application can be inspected by evaluating the following expression.
SstWebAppSpecification example1
SST extends this deployment descriptor approach by providing a SstWebServerSpecification, which is a complete specification for an application server and the web applications it is to host.
The SstHttpServerExample class demonstrates several ways in which these specification objects can be used to instantiate and run a web application in a web application server.
1. SstHttpServerExample runAt: 'http://:8788/ssteg' in: 'c:\web'
2. SstHttpServerExample run: SstWebServerSpecification example1
3. SstHttpServerExample startFromCommandLine
In addition, SST provides a helper class to facilitate startup of a dynamically-configured SST web application server in a packaged runtime image: SstHttpServletEngineBootstrap. This is intended to be used as the application entry point specified in packaging instructions.
SstHttpServletEngineBootstrap new run
The bootstrap object will load a dumped instance of SstWebServerSpecification and start a web application server according to this specification.
Classes, such as servlet implementation classes, are referenced in the specifications as Strings of the following form.
<class-name>[@<ic-name>]
If <ic-name> is specified and the named class is not loaded in the image, SST will attempt to load the image component specified by <ic-name> as the provider of an implementation for the class.
SST web application servers are compatible with the IBM WebSphere Application Server plug-in for the IBM HTTP Server. As a result, an SST web application server can be deployed in an enterprise system architecture consisting of a heterogeneous mix of application server implementations running behind the IBM HTTP Server. In addition, multiple activations of an SST web application server can run as clones within a "server group", and take advantage of the plug-in's workload balancing capability.
Since SST adopts the Servlet API for building web applications, building web applications in Smalltalk with SST is fundamentally similar to building web applications in Java. In general, the same design patterns that are used in building web applications with Java servlets can be used when building web applications with Smalltalk servlets.
Servlets are subclasses of SstHttpServlet. The typical entry points for a servlet application are #doGet: and #doPost:. These correspond to the HTTP "GET" and "POST" commands, respectively. In both scenarios, the parameter is an instance of SstHttpServletRequest. The application makes use of API implemented by this class to perform an action on behalf of the request and return an HTTP entity body - in the typical case, an HTML response page.
The sample servlets used in the implementation of SstHttpServerExample demonstrate a number of features of the servlet API, including the following.
Access to the syntactical elements of the request URI: context path, servlet path, servlet path info
Access to request parameters.
Access to HTTP headers.
The use of configured error pages in signaling HTTP errors.
The use of cookies for client session state management.
The use of server-side HTTP sessions for client session state management.
Last modified date: 01/29/2015