HTTP server for mapbox' MBTiles files.
This class features a simple HTTP server that serves the following files to serverUrl()/path. On Android the server listens on a local socket and the URL has the form unix+http://<socket name>; everywhere else it listens on a TCP port on the loopback interface and the URL has the form http://127.0.0.1:<port>. See the constructor for the reason. The client side is QNetworkAccessManager, which handles both schemes.
- If path is a file name, the server checks if the file is available in the resource system of the app and serves that file.
- If path is of the form "flightMap/sprites-night/xyz", the server serves a night-mode version of the flight map sprite sheet found in the resource system under "flightMap/sprites/xyz". The JSON files are served unchanged, the PNG files are recolored for use over the dark map style.
- If path equals "aviationData.geojson", the server returns a GeoJSON document that contains the full aviation data, as provided by GlobalObject::geoMapProvider()->geoJSON(). The reply carries a "Cache-Control: no-cache, must-revalidate" header, because the document changes with every aviation map update while its URL stays the same, and the map renderer would otherwise keep rendering a cached copy.
- If path equals the base name of an MBTilesFileSet, then the server returns a JSON document describing the MBTiles.
- If path equals "baseName/z/x/y.XXX", then the server returns an individual tile from the tile set.
This server is able to handle several sets of MBTiles files. Each set is available under a single URL, and the MBTile files in each set are expected to contain identical metadata. To serve a tile request, the server goes through the MBTiles files in random order and serves the first tile it can find. Tiles contained in more than one file need thus to be identical. A typical use case would be a server that contains to sets of files, one set with vector tiles containing openstreetmap data and one set with raster data used for hillshading. Each set contains two MBTiles files, one for Africa and one for Europe.
Definition at line 70 of file TileServer.h.