gradesheet-server.rb

Path: gradesheet-server.rb
Last Update: Tue Jul 26 14:31:53 EDT 2005

gradesheet-server.rb

WEBrick server to supply class gradesheet information. Copyright (C) 2005 by Allyn Dimock

Produces a servlet processing https on the port given by the constant PORT with root given by the constant ROOT. Constant SHEETS is an array of hashes giving the information about the sheets that are available:

  • id => name to become part of URI e.g. "foo.bar.baz.com/OOCalcGradesheetDocs/301f03/" if server is running on foo.bar.baz.com, ROOT="/OOCalcGradesheetDocs" and id => "301f03"
  • file => name of OOCalc spresasheet file to be passed to StreadsheetContent.new
  • fixed_rows => array of integers showing rows in spreadsheet to be returned along with the row for the query.
  • id_column => column in spreadsheet that contains an identifier that indicates the row to be returned.

Required files

webrick   webrick/https   gradesheet-rows  

Methods

Included Modules

WEBrick

Constants

PORT_NUMBER = 8080   Port number of server (default https port number = 443)
ROOT = "/OOCalcGradesheetDocs"   URI doesn’t use a real file name
CERTIFICATE = [ ["C","USA"], ["O","cs.uml.edu"], ["CN", "OocalcGradesheetViewer"] ]   Certificate: self-certified
SHEETS = [ {:id => '301f03', :file => "~/earth/grade301-F03/gradesheet.sxc", :fixed_rows => [1,2,20,21], :id_column => 0}, {:id => '531f03', :file => "~/earth/grade531-F03/roster.sxc", :fixed_rows => [1,35], :id_column => 1}   Gradesheets to serve: resource name, file name, rows to always return, id column

Public Instance methods

Start the web service: Create SpreadsheetContent.new for each sheet in SHEETS, Start web server Mount a resource for each gradesheet being serviced.

Define a HTTPS server following model in "Gnome’s Guide to WEBrick" by Yohanes Santoso. Create new server, then yield to caller who can mount some services, then start server.

[Validate]