eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTTPFileService':

Home

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

Class: HTTPFileService


Inheritance:

   Object
   |
   +--HTTPService
      |
      +--HTTPFileService
         |
         +--HTTPCGIService
         |
         +--MacroExpandingCSSFileService

Package:
stx:goodies/webServer
Category:
Net-Communication-HTTP-Services
Version:
rev: 1.150 date: 2023/08/04 15:56:02
user: stefan
file: HTTPFileService.st directory: goodies/webServer
module: stx stc-classLibrary: webServer

Description:


This service provides regular HTTP-file access.
All requests below the services linkName are translated
to a file-access below the services fileRoot.
An empty URL (relative to the linkName) is translated to the defaultFileName.

The ReplyPresenter is only used to decorate the files when showing the directory contents.

Service parameters:

directoryListingsAllowed
        users are allowed to browse the contents of directories.

showWorldReadableOnly
        only show the contents of files and directories, if their access rights
        allow access to everyone.

maxCacheSize
        the number of file documents that will be cached
        in memory for fast access.
        The default is 20.

maxCacheDocumentSize
        the maximum size of a file document for caching.
        Files larger are not cached.
        The default is 4K (i.e. quite small)

nameFilter
        if non-nil, this is a one-argument block, which controls the visibility
        and accessibility of files. It gets the full path filename as argument.

Take care of memory usage when increasing those values.

copyright

COPYRIGHT (c) 2003 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  fileCacheExpirationDelta
a cached files expiration time (seconds)

o  linkName
return the default path (with slash)

o  maxCacheDocumentSize
files larger are not cached

o  maxCacheSize
max nr of files to cache

o  maxDirectoryCacheSize
max nr of directory contents to cache

o  maxDirectoryCacheTimedelta
max nr of seconds for directory contents to cache

o  maxMemoryUsedForCache
max overall memory used for cache

directory list images
o  backImage
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self backImage inspect
     ImageEditor openOnClass:self andSelector:#backImage
     Icon flushCachedIcons

o  blankImage
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self blankImage inspect
     ImageEditor openOnClass:self andSelector:#blankImage
     Icon flushCachedIcons

o  commonImageDataFor: aImageName

o  commonImagePath

o  commonImages
DirectoryListingImages := nil.
self directoryListingImages

o  folderImage
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self folderImage inspect
     ImageEditor openOnClass:self andSelector:#folderImage
     Icon flushCachedIcons

o  imageList

o  linkForImage: anImageKey

o  linkForMimeType: aMimeType

o  mimeTypeImageDataFor: aMimeTypeOrKey

o  mimeTypeImagePath

o  unknownImage
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self unknownImage inspect
     ImageEditor openOnClass:self andSelector:#unknownImage
     Icon flushCachedIcons

old html-reply-composition-stx-obsolete
o  favIconFileRelativePath
notice:
this requires a file service to run for the '/files' url
on the
../../goodies/webServer/data/sampleServerDir/files/
folder

operations
o  withOverwriteBaseName: aBaseName do: aBlock

queries-service
o  isThreadSafe

o  settingsApplicationClass
my application in the settings dialog


Instance protocol:

accessing
o  allowRemoveFile

o  allowRemoveFile: aBoolean
Modified (format): / 10-01-2022 / 12:40:43 / cg

o  allowUpload

o  allowUpload: aBoolean

o  charsetOverride: something

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  directoryListingsAllowed

o  directoryListingsAllowed: 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  nameFilter: aBlock
sets an optional name filter - this will get the full pathname of the requested file.
It should return false, if access to the file is to be inhibited

o  nameFilterPattern
gets the optional name filter pattern - this will match the basename of the requested file.

o  nameFilterPattern: aGLOBPattern
sets an optional name filter pattern - this will match the basename of the requested file.

o  poweredByInfoLine
a line like 'service powered by smalltalk/x, at the end

o  poweredByInfoLine: aString
a line like 'service powered by smalltalk/x, at the end

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

o  showWorldReadableOnly
answer true, if a file or directory must be readable by the whole world in order to be shown

o  showWorldReadableOnly: something

caching
o  cacheData: data forFile: aFileName
the contents of small files is cached here

o  cachedDataForFile: aFileName fileInfo: fileInfo
small files are cached - look in the cache.
Returns the file's cached data or nil

o  fillCacheWithData: data forPseudoFile: aFileNameString
can be used to fill the cache with nonexisting, pseudo files.
These will not expire and there is no limit.

o  flushCache
flush the servers file cache

initialization
o  initialize

maintenance html presentation
o  specificChangeFromRequest: aRequest
extracts parameter from an html-maintenance post-request

o  specificInputFieldsForRequest: aRequest
generates the html-fragment for the maintenance form

queries-service
o  isAllowedInMaintenanceMode
return true, if this service is also allowed while the server is in maintenance mode

o  isCGIService

o  isFileService

request handling
o  commonImageLinkStringFor: aRequest image: anImageKey alt: altString

o  directoryListingImageLinkStringFor: aRequest image: aMimeType alt: altString

o  process: aRequest
have to redirect here because default file may contain relative links
which are expanded by the browser from the current url

o  processDirectory: dirFileName for: aRequest
generate a HTML table showing the files in the directory.

o  processDirectoryImageFor: aRequest
if the request is for a directory bitmap-image, handle it and retrn true.
Otherwise, return false.

o  processPostRequest: aRequest

o  redirectFor: aRequest
a notFoundRedirection dictionary may hold a redirection url for the notFound url

server cache control
o  fileCacheExpirationDelta
a cached files contents expiration time (seconds) - that's the server's caching time

o  fileCacheExpirationDelta: seconds
a cached files contents expiration time (seconds) - that's the server's caching time

o  maxCacheDocumentSize
the max. size of a memory-cached document

o  maxCacheDocumentSize: numBytes
the max. size of a memory-cached document

o  maxCacheSize
the max. number of cached documents

o  maxCacheSize: maxNumCached
the max. number of cached documents

o  maxMemoryUsedForCache
the max. amount of memory used for the cache.
Currently dummy - the amount is not (yet) checked for in the cache handling code

o  maxMemoryUsedForCache: numBytes
the max. amount of memory used for the cache.
Currently dummy - the amount is not (yet) checked for in the cache handling code

service-parameter
o  defaultFileName

o  defaultFileName: something

o  fileRoot

o  fileRoot: something

o  notFoundRedirection
a dictionary which redirects not found urls (keys) to a new url (value)

o  notFoundRedirection: something
a dictionary which redirects not found urls (keys) to a new url (value)

settings persistency
o  settingSelectors
answer the selectors that are used to configure a service - i.e. those which are
saved in the webServer-settings file.

Usage example(s):

     HTTPService new settingSelectors
     self new settingSelectors


Private classes:

    CachedFileInfo
    OverwriteBaseNameQuery


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 18:55:50 GMT