
FileWeblet is used to service an HTTP request on a sys::File
. It handles all the dirty details for cache control, modification time, ETags, etc.
Current implementation supports ETags and Modification time for cache validation. It does not specify any cache control directives.
Slots
- checkNotModified
-
virtual protected Bool checkNotModified()
Check if the request passed headers indicating it has cached version of the file. If the file has not been modified, then service the request as 304 and return true. This method supports ETag "If-None-Match" and "If-Modified-Since" modification time.
- etag
-
virtual Str etag()
Compute the ETag for the file being serviced which uniquely identifies the file version. The default implementation is a hash of the modified time and the file size. The result of this method must conform to the ETag syntax and be wrapped in quotes.
- file
-
readonly File file
The file being serviced by this FileWeblet (initialized in service).
- modified
-
virtual DateTime modified()
Get the modified time of the file floored to 1 second which is the most precise that HTTP can deal with.
- onGet
-
override Void onGet()
Handle GET request for the file.
- service
-
override Void service()
Handle GET request for the file.