Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2108

Make JsonBindingProvider more restrictive (@Consumes/@Provides media types)

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Major
    • 4.0.0.Beta7
    • None
    • None
    • None

    Description

      The JsonBindingProvider has the following annotations:

      @Produces({"application/json", "application/*+json", "text/json", "*/*"})
      @Consumes({"application/json", "application/*+json", "text/json", "*/*"})
      

      And then we have this code checking it has something to do with JSON in the end:

      public static boolean isSupportedMediaType(final MediaType mediaType) {
            return mediaType.getSubtype().equals(JSON) || mediaType.getSubtype().endsWith(PLUS_JSON);
         }
      

      I think we should be consistent with the ResteasyJackson2Provider in which we restricted the matches (compared to the provider provided by Jackson):

      @Consumes({"application/json", "application/*+json", "text/json"})
      @Produces({"application/json", "application/*+json", "text/json"})
      

      By the way, it's not just about being consistent, if the provider is registered for /, I can't eliminate it from the global candidates even if I'm just working with XML if I end up having this provider in the classpath.

      And if we need to support more, we can still push more things there (and probably keep the list consistent between JSON-B and Jackson).

      Attachments

        Issue Links

          Activity

            People

              rhn-support-asoldano Alessio Soldano
              gsmet@redhat.com Guillaume Smet
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: