Server Actions

PWS contains a number of ServerActions as examples. They serve to demonstrate the range of things that a ServerAction might perform.

ServerActions are associated with keys using PWS' class method link:to:. Look at PWS class method initializeAll for several examples.


The basic ServerAction completes the PWS as a Macintosh file server. Its process: method looks like this:

process: request
	| pieces |
	self checkAuthorization: request.
	pieces := self parse: request.
	self log: pieces to: request.
	self replyTo: pieces from: request.

parse: simply replaces "/" in the URL with ":" and prefixes the serverDirectory path to create a Mac file path. (If no filename is specified, "default.html" is inserted.) replyTo:request: simply does a reply: of the filecontents to the request.


EmbeddedServerAction is a subclass of ServerAction. It overrides replyTo:from: to evaluate the embedded Smalltalk code before returning it. As installed, it serves from an /embedded/ directory under the Server directory.


Is a subclass of ServerAction, but doesn't really need to be. A PluggableServerAction instance stores two blocks: One gets executed to process forms input (processBlock), and the other gets executed to generate a return value (returnBlock). Both of the blocks take the Web request as input. I haven't used this one yet, but it meshes with my image of a CGI script application as a graph where processing occurs on the arcs and the pages are states.


The version that I have tried simply has a processBlock. The processBlock code is responsible for getting a reply: out to the request.


Is a subclass of EmbeddedServerAction. It has an instance of Authorizer, and it checks the incoming user's name and password against the users in the Authorizer before allowing access. As installed, it serves from an /authorized/ directory under the Server directory.

"More About Squeak..."
Home Page for How To Squeak

Last modified at 1/30/98; 9:56:43 AM
Other Links of Interest
College of Computing | EduTech Institute | GVU Center
Mark Guzdial | CS2390, Modeling and Design | STABLE