
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.
- doGet
-
override Void doGet()
Handle GET request for the file.
- 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.
- extToMime
-
static Str:Str extToMime
This is a static map of file extension to MIME type. Right now it is based on a simple props file stored in
lib/ext2mime.props
, but eventually needs to be reworked as we define more of the architecture. - 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.
- service
-
override Void service()
Handle GET request for the file.