Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisit MediaType ordering #27580

Closed
poutsma opened this issue Oct 19, 2021 · 0 comments
Closed

Revisit MediaType ordering #27580

poutsma opened this issue Oct 19, 2021 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@poutsma
Copy link
Contributor

poutsma commented Oct 19, 2021

We should reconsider the way we order MediaType objects. Currently we use Comparators to sort media types in order of preference, but those need to be transitive (see #27488). We should investigate other ordering mechanisms for 6.0, possibly dropping the comparators altogether in favor of a less restrictive, though possibly slower, ordering algorithm.

@poutsma poutsma added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Oct 19, 2021
@poutsma poutsma added this to the 6.0 M1 milestone Oct 19, 2021
@poutsma poutsma self-assigned this Oct 19, 2021
poutsma added a commit to poutsma/spring-framework that referenced this issue Oct 20, 2021
This commit makes several changes to MimeType and MediaType
related to the topic of specificity.

This commit deprecates the MimeType and MediaType Comparators.
Comparators require a transitive relationship, and the desired order for
these types is not transitive (see spring-projects#27488).

Instead, this commit introduces two new MimeType methods: isMoreSpecific
and isLessSpecific, both of which return booleans. MediaType overrides
these methods to include the quality factor (q) in the comparison.

All MediaType sorting methods have been deprecated in favor of
MimeTypeUtils::sortBySpecificity.  This sorting method now uses
MimeType::isLessSpecific in combination a bubble sort algorithm (which
does not require a transitive compare function).

Closes spring-projectsgh-27580
poutsma added a commit to poutsma/spring-framework that referenced this issue Oct 20, 2021
This commit changes all code that uses now deprecated methods in
MimeType and MediaType.

See spring-projectsgh-27580
poutsma added a commit to poutsma/spring-framework that referenced this issue Oct 20, 2021
This commit makes several changes to MimeType and MediaType
related to the topic of specificity.

This commit deprecates the MimeType and MediaType Comparators.
Comparators require a transitive relationship, and the desired order for
these types is not transitive (see spring-projects#27488).

Instead, this commit introduces two new MimeType methods: isMoreSpecific
and isLessSpecific, both of which return booleans. MediaType overrides
these methods to include the quality factor (q) in the comparison.

All MediaType sorting methods have been deprecated in favor of
MimeTypeUtils::sortBySpecificity.  This sorting method now uses
MimeType::isLessSpecific in combination a bubble sort algorithm (which
does not require a transitive compare function).

Closes spring-projectsgh-27580
poutsma added a commit to poutsma/spring-framework that referenced this issue Oct 20, 2021
This commit changes all code that uses now deprecated methods in
MimeType and MediaType.

See spring-projectsgh-27580
poutsma added a commit to poutsma/spring-framework that referenced this issue Oct 20, 2021
This commit makes several changes to MimeType and MediaType
related to the topic of specificity.

This commit deprecates the MimeType and MediaType Comparators.
Comparators require a transitive relationship, and the desired order for
these types is not transitive (see spring-projects#27488).

Instead, this commit introduces two new MimeType methods: isMoreSpecific
and isLessSpecific, both of which return booleans. MediaType overrides
these methods to include the quality factor (q) in the comparison.

All MediaType sorting methods have been deprecated in favor of
MimeTypeUtils::sortBySpecificity.  This sorting method now uses
MimeType::isLessSpecific in combination a bubble sort algorithm (which
does not require a transitive compare function).

Closes spring-projectsgh-27580
poutsma added a commit to poutsma/spring-framework that referenced this issue Oct 20, 2021
This commit changes all code that uses now deprecated methods in
MimeType and MediaType.

See spring-projectsgh-27580
poutsma added a commit to poutsma/spring-framework that referenced this issue Oct 20, 2021
This commit makes several changes to MimeType and MediaType
related to the topic of specificity.

This commit deprecates the MimeType and MediaType Comparators.
Comparators require a transitive relationship, and the desired order for
these types is not transitive (see spring-projects#27488).

Instead, this commit introduces two new MimeType methods: isMoreSpecific
and isLessSpecific, both of which return booleans. MediaType overrides
these methods to include the quality factor (q) in the comparison.

All MediaType sorting methods have been deprecated in favor of
MimeTypeUtils::sortBySpecificity.  This sorting method now uses
MimeType::isLessSpecific in combination a bubble sort algorithm (which
does not require a transitive compare function).

Closes spring-projectsgh-27580
poutsma added a commit to poutsma/spring-framework that referenced this issue Oct 20, 2021
This commit changes all code that uses now deprecated methods in
MimeType and MediaType.

See spring-projectsgh-27580
poutsma added a commit that referenced this issue Nov 23, 2021
This commit changes all code that uses now deprecated methods in
MimeType and MediaType.

See gh-27580
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant