Carapace

HttpServer Class

The HttpServer object provides a multi-threaded Web server which allows pages of HTML or pictures to be accessible to web browsers on your intranet or over the internet.

The Carapace HttpServer object allows HTML pages to contain embedded script fragments. This allows the web server to generate the HTML pages 'on the fly', giving access to databases or other systems. See HTML Templates for more information.

HttpServer Creation

The create function can be used to create a HttpServer object eg.

    (create HttpServer "c:/temp/docs" 80)
where the arguments are:

rootDirectory directory which is the root of the hierarchy holding the files served by the web server
port TCP port number for listening on -- the default HTTP port is 80

Once created, this object is tailored using its properties and methods.

HttpServer Properties

A HttpServer object supports the following properties:

property name property type description
root String directory which is the root of the hierarchy holding the files served by the web server
host String domain name of this host
port Integer TCP port on which the server listens
initialPage String name of the initial page to be returned if a client requests the root URL /
errorPage String name of the page to be returned if an error occurs

HttpServer Methods

The HttpServer object supports the following methods:

method name description
handlerThreads set the maximum number of handler threads -- the default is 4
start start the web server
stop stop the web server


handlerThreads

Set the maximum number of handler threads -- the default is 4. This will only take effect if done before starting the server.

Arguments:

nThreadsInteger

Return type: the empty List ()


start

Start the web server.

Arguments: none

Return type: the empty List ()


stop

Stop the web server.

Arguments:

gracePeriodInteger

Return type: the empty List ()


Contents Index Current topic: communications Related topics: communications classes, objects