Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-15367

Improve support for fixed content type in ContentNegotiationManager

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.3.3
    • Fix Version/s: 5.0 RC1
    • Component/s: Web

      Description

      ContentNegotiationConfigurer currently supports setting a default content type for all end points, or a content negotiation strategy. While useful, this can run into problems for applications with a variety of supported content types.

      For example, if an application has set the default content type to "text/html", and has an end point which only supports "application/json", any calls which do not specify an accept header, or which specify "/" as the accept header, will receive a 406 response.

      This is consistent with the documented behavior of setting the default content type, but applications such as these often would like to specify the preferred content type, as opposed to a forced default.

      Such a configuration would ideally allow the above example to specify that endpoints that support "text/html" prefer to return it when no specific content type is requested, but still allow end points which do not support "text/html" to chose from among the media types they support (in the same manner as when no default content type is specified)

        Attachments

          Activity

            People

            • Assignee:
              rstoya05-aop Rossen Stoyanchev
              Reporter:
              rDotJar Ryan O'Meara
              Last updater:
              St├ęphane Nicoll
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 16 weeks, 2 days ago