How to cache the Driving Range 3D Model¶
When issuing a GET
request to download the Driving Range 3D model, the response headers will contain an Etag
header, which identifies the version of the 3D model that is installed on the server. If a new model is uploaded on the server, the ETag
value will change. Therefore, it can be used in order to conditionally retrieve the 3D model resource, only if it has changed since the last time the client has downloaded it.
The first time the client issues a GET
request, it' s going to download the full 3D model locally and remember the ETag
value. The next time, the client will issue a conditional GET
including the additional header If-None-Match
containing the value of the Etag that it had previously saved:
First request:
GET {MODEL-DOWNLOAD-URI} Host: localsite.trackmanrange.com
Response:
200 OK ETag: "1b6461003ce1cb46638a206e647b02e5"
Second request:
GET {MODEL-DOWNLOAD-URI} Host: localsite.trackmanrange.com If-None-Match: "1b6461003ce1cb46638a206e647b02e5"
If the model hasn't changed, the server is going to respond with the status code 304 Not Modified
. Otherwise the downloading of the model is going to proceed as usual.
Note
The double quotes surrounding the Etag value are part of the value and are mandatory according to the spec. As a rule of thumb, supply to the If-None-Match header the Etag value exactly as it was previously returned from the server.