Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-2098

Resteasy Reactive: Fix support of media types with suffixes

XMLWordPrintable

      Given a media type with suffix, for example: "application/test+json".

      Before these changes, Resteasy Reactive was trying to find the writer/reader using only the suffix. For example, with a media type "application/test+json", it would only use "json" to locate the right writer/reader.

      Spite of this has been working well so far, if users provide a custom writer/reader for a concrete media type with suffix:

      ```java
      @Provider
      @Produces("text/test+suffix")
      public static class SuffixMessageBodyWriter implements ServerMessageBodyWriter<Object> {

      @Override
      public boolean isWriteable(Class<?> type, Type genericType, ResteasyReactiveResourceInfo target, MediaType mediaType)

      { // ... }

      @Override
      public void writeResponse(Object o, Type genericType, ServerRequestContext context)

      { // ... }

      // ...
      }
      ```

      The above writer will never be used.

      After these changes, we will use the media type with suffix, plus the split parts of the suffix. For example, if the media type with suffix is: "application/test+json", it will try to find the best writer/reader for "application/test+json", "application/test" and then "application/json" (In this order).

      Fix https://github.com/quarkusio/quarkus/issues/15982

              Unassigned Unassigned
              probinso_jira Quarkus JIRA Bot (Inactive)
              Fedor Dudinskii Fedor Dudinskii
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: