The FileHandlerPlugin schema defines the configuration for static file serving in Rusty Beam. This is a core handler plugin that serves files from the filesystem, handles MIME types, and provides basic file operations like GET, PUT, and DELETE.
Schema URL: https://rustybeam.net/schema/FileHandlerPlugin
Parent Schema: https://rustybeam.net/schema/HandlerPlugin
Property | Type | Cardinality | Description | Source |
---|---|---|---|---|
library |
URL | 1 | Plugin library path | Plugin |
config_file |
Text | 0..1 | Optional configuration file for custom MIME types or file serving rules | HandlerPlugin |
<td itemprop="plugin" itemscope itemtype="https://rustybeam.net/schema/FileHandlerPlugin">
<span itemprop="library">file://./plugins/librusty_beam_file_handler.so</span>
</td>
<td itemprop="plugin" itemscope itemtype="https://rustybeam.net/schema/FileHandlerPlugin">
<span itemprop="library">file://./plugins/librusty_beam_file_handler.so</span>
<span itemprop="config_file">config/mime-types.html</span>
</td>
Method | Operation | Description | Authorization |
---|---|---|---|
GET |
Read File | Serves file content with appropriate MIME type | Typically public |
HEAD |
File Info | Returns headers without body (file size, type, etc.) | Same as GET |
PUT |
Upload/Update | Creates or updates file content | Requires authorization |
DELETE |
Remove File | Deletes file from filesystem | Requires authorization |
Control which users can access files using authorization rules:
<!-- Allow everyone to read assets -->
<tr itemscope itemtype="https://rustybeam.net/schema/AuthorizationRule">
<td><span itemprop="username">*</span></td>
<td><span itemprop="path">/assets/*</span></td>
<td><span itemprop="method">GET</span></td>
<td><span itemprop="action">allow</span></td>
</tr>
<!-- Restrict file uploads to admins -->
<tr itemscope itemtype="https://rustybeam.net/schema/AuthorizationRule">
<td><span itemprop="role">administrators</span></td>
<td><span itemprop="path">/uploads/*</span></td>
<td><span itemprop="method">PUT</span></td>
<td><span itemprop="action">allow</span></td>
</tr>
The file handler works seamlessly with the selector handler for HTML manipulation. The selector handler processes CSS selector requests, and if no selectors are found, the file handler serves the complete file.
Extension | MIME Type | Description |
---|---|---|
.html | text/html | HTML documents |
.css | text/css | Stylesheets |
.js | application/javascript | JavaScript files |
.json | application/json | JSON data |
.png | image/png | PNG images |
.jpg | image/jpeg | JPEG images |
.svg | image/svg+xml | SVG images |
application/pdf | PDF documents |