eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTTPScriptProviderService':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: HTTPScriptProviderService


Inheritance:

   Object
   |
   +--HTTPService
      |
      +--HTTPScriptProviderService

Package:
stx:goodies/webServer
Category:
Net-Communication-HTTP-Services
Version:
rev: 1.5 date: 2022/10/07 12:02:26
user: stefan
file: HTTPScriptProviderService.st directory: goodies/webServer
module: stx stc-classLibrary: webServer

Description:


This service provides regular HTTP-file access, but the file contents
is not static (i.e. not from a real file), but instead constructed
by a registered retriever (i.e. this is an action=pluggable service).
Retrievers are blocks which are registered with
    theService register:block for:relativePath

This is useful to provide scripts or other dynamic data.

[examples:]
    |service|

    service := self new.
    service register:[ e'hello world; the time is {Time now}' ] for:'test.txt'.
    service registerServiceOnPort:8080.

    -- now open a browser on 'http://localhost:8080/scripts/test.txt'.

copyright

COPYRIGHT (c) 2020 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

defaults
o  defaultExpirationTime
a documents expiration time in seconds (returned to browser for its cache)

o  linkName
return the default path (with slash)

queries-service
o  isThreadSafe


Instance protocol:

accessing
o  checkReferrer
when true, the document's referrer must be a page from me
(i.e. do not allow cross-site links to my documents).
The only exception to this are the services' defaulFileName and root.

o  checkReferrer: aBoolean

o  expirationTime
a documents expiration time in seconds (returned to browser for its cache)

o  expirationTime: seconds
a documents expiration time in seconds (returned to browser for its cache).
An expirationTime of 0 disables the browsers caching.
Caveat: should be named maxAge:

o  reportForbiddenDirectoryListing
return true, if a request to list a directory should be
reported as forbidden (403) or as not found (404).
If true, users could learn (and try) the directory structure.
The default is true.
Should probably be settable in the SettingsDialog

registration
o  register: aBlock for: relativePath

request handling
o  process: aRequest
does not really make sense, because some (many ?) browsers do not



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 08 Sep 2024 02:42:45 GMT