eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTTPFileService':

Home

everywhere
www.exept.de
for:
[back]

Class: HTTPFileService


Inheritance:

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

Package:
stx:goodies/webServer
Category:
Net-Communication-HTTP-Services
Version:
rev: 1.111 date: 2009/07/10 11:17:37
user: cg
file: HTTPFileService.st directory: goodies/webServer
module: stx stc-classLibrary: webServer
Author:
Christian Penk

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)

Take care of memory usage when increasing those values.


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.

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

o  commonImageDataFor: aImageName

o  commonImagePath

o  commonImages

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

o  imageList

o  linkForImage: anImageKey

o  linkForMimeType: anMimeType

o  mimeTypeImageDataFor: aMimeTypeOrKey

o  mimeTypeImagePath

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

queries-service
o  isThreadSafe

o  settingsApplicationClass
my application in the settings dialog


Instance protocol:

accessing
o  allowRemoveFile

o  allowRemoveFile: something

o  checkReferrer
when true, the documents referrer must be a page from me
(i.e. do not allow cross-site links to my documents).
The onlz 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  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 files data or nil

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

response generation
o  commonImageLinkStringFor: aRequest image: anImageKey alt: altString

o  directoryListingImageLinkStringFor: aRequest image: aMimeType alt: altString

o  process: aRequest

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  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) - thats the servers caching time

o  fileCacheExpirationDelta: seconds
a cached files contents expiration time (seconds) - thats the servers 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.


Private classes:

    CachedFileInfo


ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 10:04:08 GMT