A resource file request handler. This handles a request by sending the contents of the resource file matching the given name.

To expose a bundled game resource as a Web object that the client can access and download via HTTP, simply create an instance of this class, and set the virtual path (the vpath property) to the resource name. See coverArtResource below for an example - that object creates a URL for the Cover Art image so that the browser can download and display it.

You can expose *all* bundled resources in the entire game simply by creating an object like this:

vpath = static new RexPattern('/')

That creates a URL mapping that matches *any* URL path that corresponds to a bundled resource name. The library intentionally doesn't provide an object like this by default, as a security measure; the default configuration as a rule tries to err on the side of caution, and in this case the cautious thing to do is to hide everything by default. There's really no system-level security risk in exposing all resources, since the only files available as resources are files you explicitly bundle into the build anyway; but even so, some resources might be for internal use within the game, so we don't want to just assume that everything should be downloadable.

You can also expose resources on a directory-by-directory basis, simply by specifying a longer path prefix:

vpath = static new RexPattern('/graphics/')

Again, the library doesn't define anything like this by default, since we don't want to impose any assumptions about how your resources are organized.

class WebResourceResFile :   WebResource

Superclass Tree   (in declaration order)


Subclass Tree  


Global Objects  

coverArtResource  webMainWin  webuiResources 

Summary of Properties  

binaryExts  browserExtToMime 

Inherited from WebResource :
group  priority  vpath 

Summary of Methods  

isTextFile  matchRequest  processName  processRequest 

Inherited from WebResource :
sendAck  sendXML 



table of common binary file extensions

extension to MIME type map for important browser file types


isTextFile (fname)webui.t[1061]

Determine if the given file is a text file or a binary file. By default, we base the determination solely on the filename suffix, checking the extension against a list of common file types.

matchRequest (query, req)OVERRIDDENwebui.t[986]
Match a request. A resource file resource matches if we match the virtual path setting for the resource, and the requested resource file exists.

processName (n)webui.t[1054]
Process the name. This takes the path string from the query, and returns the resource file name to look for. By default, we simply return the same name specified by the client, minus the leading '/' (since resource paths are always relative).

processRequest (req, query)OVERRIDDENwebui.t[992]
process the request: send the resource file's contents

TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3