Resource Handler




Resource Handler is used to return files that are considered web resources that are not media. This includes things like JavaScript, CSS stylesheets, XML, HTML and other file formats (this is based on configuration). Resource Handler uses Wave Frameworks on-demand resource loader, which allows to combine multiple files to a single resource file or minify contents of the scripts. It also checks for files from overrides folder, which can be returned instead of the actual file.


This script can only be executed through Index Gateway and it throws a 403 Forbidden message if accessed directly.

Resource Handler considers the requested file extension as the content type for the returned file. It supports JavaScript, CSS stylesheets, XML, text file, CSV, HTML, RSS and vCard formats by default and serves any other type of file as a text string.

Multiple files can be requested by separating these files with a & symbol in the request URL, if this is enabled in configuration.

Cache headers are also returned by Resource Handler based on their default duration in configuration file (default would be one year). It is possible to request a file without using cache by providing 'nocache' flag in the file, in which case Resource Handler always generates the file again.

It checks if the file has an override in /overrides/resources/ folder, if it has then that file is returned instead. Handler also returns a 304 Not Modified header if it detects that the user agent has the latest version.

If 'minify' flag is defined in the file request URL, then resource is also minified with Minifier class.

A BASE64 encoded string of the resource is returned if dynamic variable 'base64' is provided in the request. This can be useful in some situations.

Resource Handler also compresses the output, which reduces the bandwidth on the web server.

Resource Handler also caches each of the dynamically loaded resource in file system, which makes sure that the file isn't re-generated with every new HTTP request.

Handler returns the content with all the appropriate headers, from cache to content size and robots information (based on configuration).

Resource Handler also makes an entry in the log file about the request, if Logger is used.