|
Class: HTTPScriptProviderService
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
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'.
copyrightCOPYRIGHT (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.
defaults
-
defaultExpirationTime
-
a documents expiration time in seconds (returned to browser for its cache)
-
linkName
-
return the default path (with slash)
queries-service
-
isThreadSafe
-
accessing
-
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.
-
checkReferrer: aBoolean
-
-
expirationTime
-
a documents expiration time in seconds (returned to browser for its cache)
-
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:
-
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
-
register: aBlock for: relativePath
-
request handling
-
process: aRequest
-
does not really make sense, because some (many ?) browsers do not
|