Static Export configuration
From OpenCms Wiki
Contents |
Static Export Configuration
See also: Static Export
The Role of the OpenCms Error Handler during Static Export
The static export is always based on a specialized "Error-Handler". This Errorhandler as part of opencms and has an own URL perfix (e.g. /handle404/).
There are two ways, how this Handler is used to trigger the export of an existing file into the file system:
- The way of triggering the Error Handler happens, if a user requests a file that is not yet exported into the file system. In this case the web server issues a file not found error (HTTP code 404). The webserver must be configured so that it calls the specialized Errorhandler of OpenCms. The Errorhandler will then cause the missing file to be processed and the results are written into the file system. It also returns the processing result for the requested file to the requesting client, so that the client will not notice that an internal file-not-found error had occurred inside of the server.
After that, an exported form of the requested file will exist in the file system. This will speed all future requests for the given file, as all future requests can be directly satisfied with that exported file. This method is called Static Export On Demand.
- Another export method is called Static Export After Publish. It also uses the error handler's mechanism for exporting files. If this method of publishing is active, then OpenCms will export files as soon as changes are published. At that point, OpenCms will check the Export configuration for any resource sets that are defined there. When at least one file that belongs to a defined resource set is exported, then all other files that belong to that set are also exported. Resource sets are defined by one or more regular expressions annd all files whose path matches one of these expressions, belongs to the given resource set.
If a file is exported, which belongs to no resource set at all, then all exportable files in the system are exported. The export is triggered by OpenCms calling it's own Errorhandler via HTTP for each file to be exported. This will cause these files to be exported into the file System. If a file has existed before, then it will be overwritten.
Because the Error handler is used for both Static Export methods, it must be working correctly, otherwise the export will fail. Also, for Static Export After Publish, the URL prefix of the Errorhandler must be corretly configured in the export configuration, so that opencms is able to call it's own errorhandler via HTTP.