OGC API - Features - Plugin breaks core `/rest` API with JSON payloads

Description

When using the latest version of the OGC API plugin, the core /rest API breaks with JSON payloads. For example, than it is no longer possible to create a workspace by using a JSON payload.

Steps to reproduce:

1. Download latest GeoServer WAR and latest OGC API plugin.
2. Deploy it within Tomcat.
3. Try to create a workspace as follows:

 

Within the GeoServer logs you will find the following stack trace:

 

Further investigations have shown that the OGC API plugin registers a custom implementation of MappingJackson2HttpMessageConverter:

By commenting out this line, the core /rest API does not break and the above request works as expected.

It seems like that some Jackson mappers are lost from core, when the OGC API plugin registers the custom converter.

Environment

None

Activity

Andrea Aime 
February 1, 2023 at 5:51 PM

Merged and backported to 2.22.x

Sebastian Frey 
January 27, 2023 at 6:04 PM

thanks for letting me know.

Indeed, a custom annotation solution would be very heavy handed.

Andrea Aime 
January 27, 2023 at 5:14 PM

If you like to have a look, I’ve prepared a PR to fix this here:

Overall it’s based on heuristics, as in theory both controllers can handle any type of object. Tried to isolate the write side by using class checks and package checks on the object being encoded, the read side is harder because any sort of object can be read (no RestWrapper to help here), so based decision on the controllers package instead (on the OGC API side).

Another possibility could have been to roll custom annotations and tag every controller and object… but it would have been pretty heavy handed.

Andrea Aime 
January 23, 2023 at 12:54 PM

Hum it’s actually the opposite I think… that converter should not be used, XStream should be involved instead.

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created January 17, 2023 at 1:44 PM
Updated May 8, 2023 at 8:23 AM
Resolved February 1, 2023 at 5:51 PM