HTTPServer Main Help Index

A Useful Configuration to Play With

The following describes a configuration which is useful to start playing with (to learn more about and demonstrate the functionality of the framework):

Please perform the following actions:

  1. To create a new server:

    Now, a new item appears in the tree which represents that new server. It has not yet been started, but is ready to be configured. You can either start the server right now (even though it will not have any service to offer yet) or start it after the services have been configured.
    When adding services, there is no need to stop and restart the server; services can be added both to a stopped and to an already running server.

    Notice:
    For your convenience, the setting-dialog will configure a number of example services iff the servers port is "8080". To avoid this (and to follow this configuration example exactly) either use a port different from 8080, or remove the automatically configured services (in the services dialog).

  2. To start the new server: Now, the server is running, and avaiting incoming requests.

  3. Open a webBrowser:

    You can now open your favourite webBrowser (either locally or from a remote machine)
    and navigate to "http://<yourHostName>:8081/".
    Replace "<yourHostName>" with the name of your machine (or "localhost" if you started the webBrowser on the same machine) and replace the "8081" with whatever port you used in the aforementioned port setting.

    Unless you have already configured some service(s) in the webServer, the webBrowser will now show an error-message (such as: "No Service for Home" or simlar).
    This is normal behavior at this time, because no service has been configured yet.

  4. Adding a File Access Service:

    The most basic service is a FileService, which returns regular files from some place in your fileSystem.
    To add such a service, perform these steps:

    Now, a new item appears in the tree under the services item, which represents that new file service. Select this item and proceed to configure: Now, you should be able to access these files via your webBrowser; try navigating to the "/files" location (i.e. go to "http://<yourHostName>:8081/files"); this should present the default file.

    You can add multiple file services, each with its own linkName and each with its own directory and optional default files.
    Especially, this allows you to embed already existing home pages into your browsers pages.

  5. Adding a CGI scripting service:

    The CGI-service allows for external scripts or executable programs to be used for dynamic page generation.
    Scripts are often used for counters, dynamic database access etc.
    A CGI-Service has the same configuration parameters as a regular file-service.
    When handling a request, the service looks if the requested file is executable and, executes it as a program (or script). The programs standard-output is collected and returned to the webBrowser.
    If the file is not executable, it is assumed to be a regular text-file and returned in the same way a regular fileService would.
    To add a demo-CGIservice, perform these steps:

    Now, you should be able to retrieve CGI-script-generated webPages via your webBrowser; try navigating to the "/files" location (i.e. go to "http://<yourHostName>:8081/cgi-bin/README") for more info.

    CGI support is mostly provided to allow for existing webPages to be embedded seamlessly.

  6. Adding pages with embedded Smalltalk code (STT pages):

    The STT-service can process template pages with embedded Smalltalk code (this very similar to php).

    Some example pages for this are provided in the "../../goodies/webServer/data/comancheSTT/" directory.

    For demonstration, create a "CommancheSTTService" and visit it via the "http://<yourHostName>:8081/stt" link, which gives more information and provides links to more examples.

    STT provides a very powerful framework, in which html-pages can be created even by non-programmers and enhanced either by embedding Smalltalk code right into them, or by calling appropriate functions in the Smalltalk system from those pages.
    STT pages have access to the full power of the underlying Smalltalk system, and are in real use in some of our own projects (with success).

  7. Adding WIKI pages:

    A WIKI consists of webPages which can be modified by other people. They function similar to whiteboards or public discussion boards.

    There are numerous options in setting up a Smalltalk WIKI, and therefore, the Smalltalk WIKI provides its own setup pages, to administer access (read/write/upload etc.), users and passwords, and page layout.

    The ST/X web framework as delivered already contains in its standard configuration the classes and (empty) swiki-pages to play with (this was ported from the popular Comanche-Smalltalk-WIKI).

    For demonstration, create a "CommancheSwikiService" and visit one of the WIKI-books via any of the following links:
        "http://<yourHostName>:8081/ComancheSwiki/exept"
        "http://<yourHostName>:8081/ComancheSwiki/refs"
        "http://<yourHostName>:8081/ComancheSwiki/admin"

    The default user:password for the admin-pages is "admin:password". This should be changed if you make the swiki accessible to the public.

    More information and additional links are found in the swiki and by googling for "comanche swiki".

  8. Programmed Services

    Until now, all services were file-based; i.e. they either consisted of plain html files or consisted of files with embedded scripting code.
    The full power of the Smalltalk programming environment (browsers, inspectors, debuggers objects and classes etc.) can be exploited, if the service is implemented as a Smalltalk service-class.

    Of course, there are unlimited possibilities of what can be done, therefore the following examples can only give a rough overview on the possibilities.

    The simplest of the programmed services is the HelloWorldService, which (what woud you expect) simply answers with a hello world page.

    To try it, add the "Demos::HelloWorldService" to your service list, and visit the "http://<yourHostName>:8081/Hello"-link.

    This is the absolute simplest possible programmed webService, and can be used as a start to write your own (copy it in the browser, and add more fuctionality as required).
    The class you would want to look at is "Demos::HelloWorldService".

    For more sophisticated examples, try the other demo-services:     "Demos::WebDemoApp1"
        "Demos::WebProcessList"
        "Demos::WebScreenImage"
    and, as a very nice example,
        "Demos::WebSlideShow"
    which must be configured for a particular directory and presents a slideShow of the images found there (share your holiday-photos !).

  9. The Home Page Service

    This is a convenient service, which collects the names and links of some other configured services, and presents them nicely formatted as an entry page.
    Configure the "Demos::WebHomePageForSTX" with "/Home" as linkName, and change the HTTPServers defaultRoot setting to "/Home".

    The "Demos::WebHomePageForSTX" is also very usable as a template to write your own home page service.

Have fun

Copyright © 2003 eXept Software AG, all rights reserved


Doc $Revision: 1.7 $ $Date: 2016/09/14 09:41:11 $