Fan

 

class

web::FileWeblet

sys::Obj
  web::Weblet
    web::FileWeblet

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

checkNotModifiedSource

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.

etagSource

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.

fileSource

readonly File file

The file being serviced by this FileWeblet (initialized in service).

modifiedSource

virtual DateTime modified()

Get the modified time of the file floored to 1 second which is the most precise that HTTP can deal with.

onGetSource

override Void onGet()

Overrides web::Weblet.onGet

Handle GET request for the file.

serviceSource

override Void service()

Overrides web::Weblet.service

Handle GET request for the file.