WebResourceResFile class | webui.t[980]

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:

WebResourceResFile
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:

WebResourceResFile
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)

`WebResourceResFile`
`WebResource`
`object`

Subclass Tree

`WebResourceResFile`
`WebWindow`
`WebCommandWin`
`WebLayoutWindow`
`WebStatusWin`

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`

Properties

`binaryExts` | `webui.t[1083]`

table of common binary file extensions

`browserExtToMime` | `webui.t[1043]`

extension to MIME type map for important browser file types

Methods

`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)`OVERRIDDEN | `webui.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)`OVERRIDDEN | `webui.t[992]`

process the request: send the resource file's contents

Adv3Lite Library Reference Manual
Generated on 03/07/2024 from adv3Lite version 2.1