Skip to content

Add hakunapi-tiles-servlet-jakarta, pre-encoded responses and collectionless mode - #239

Merged
jampukka merged 1 commit into
nlsfi:mainfrom
jampukka:tiles/servlet
Oct 16, 2026
Merged

jampukka merged 1 commit into
nlsfi:mainfrom
jampukka:tiles/servlet

Conversation

@jampukka

Copy link
Copy Markdown
Collaborator

Jakarta-RS implementation of the OGC API Tiles endpoints + additional /{tileMatrixSetId}/tilejson.json (as it's defacto needed by all clients). No tile source implements the tiles-core SPIs on main yet, so the module publishes nothing until one does; only the discovery path is tested here.

Key classes:

  • TilesApiExtensionFactory / TilesApiExtension
    • Found through ServiceLoader, so being on the classpath is what enables it. Returns nothing when no tile layer is configured.
    • Contributes the tile operations, injectables and collection links through ApiExtension.
  • TileResponse
    • Builds the tile response; hands already-gzipped tiles over as PreEncodedBytes / PreEncodedOutput instead of compressing them again.

Pre-encoded responses in hakunapi-simple-servlet-jakarta, key classes:

  • PreEncodedBytes / PreEncodedOutput
    • Marks an entity whose bytes already carry their Content-Encoding. PreEncodedBytes has its length known up front (PreEncodedBytesWriter reports it, so no chunking).
  • GzipInterceptor
    • Skips these entities rather than compressing them twice.
  • GunzipInterceptor
    • Inflates them for a client that does not accept gzip. Deliberately the slow path; it exists for correctness.

Collectionless mode

  • A service with no collections can start. HakunaContextListener claims the OGC API - Common classes always and the Features-specific ones only when collections exist.

    • This means hakunapi doesn't claim support to OGC API Features conformance classes
  • GetCollectionQueryablesImpl becomes a DynamicPathOperation (like the items operations), so a collectionless service does not advertise /collections/{collectionId}/queryables.

  • A missing collections property no longer fails startup (previously readCollectionIds() threw). A misspelled key now starts an empty service; the listener logs a warning when there are no collections and no extension published anything. ConfigTest warns as well.

  • Accept-Encoding: gzip;q=0 is treated as not accepting gzip when deciding whether to inflate pre-encoded entities.

@jampukka
jampukka merged commit 46edf1f into nlsfi:main Oct 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant