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

Introduce addSupportedMediaTypes() in FormHttpMessageConverter #23203

Closed
1 task done
sbrannen opened this issue Jun 27, 2019 · 0 comments
Closed
1 task done

Introduce addSupportedMediaTypes() in FormHttpMessageConverter #23203

sbrannen opened this issue Jun 27, 2019 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Jun 27, 2019

Status Quo

Although it is currently possible to add a custom supported MediaType to FormHttpMessageConverter, it is a bit cumbersome since the List returned by getSupportedMediaTypes() is immutable, which leads to code similar to the following.

FormHttpMessageConverter converter = // ...
List<MediaType> supportedMediaTypes = new ArrayList<>(converter.getSupportedMediaTypes());
supportedMediaTypes.add(new MediaType("text", "custom-type"));
converter.setSupportedMediaTypes(supportedMediaTypes);

Proposal

It would be great if adding a custom media type was as simple as the following, where addSupportedMediaTypes() accepts a var-args list.

FormHttpMessageConverter converter = // ...
converter.addSupportedMediaTypes(new MediaType("text", "custom-type"));

Related Issues

Deliverables

  • Introduce addSupportedMediaTypes(MediaType...) in FormHttpMessageConverter.
@sbrannen sbrannen self-assigned this Jun 27, 2019
@sbrannen sbrannen added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Jun 27, 2019
@sbrannen sbrannen modified the milestones: 5.2 GA, 5.2 RC1 Jun 27, 2019
@sbrannen sbrannen changed the title Introduce addSupportedMediaType() in FormHttpMessageConverter Introduce addSupportedMediaTypes() in FormHttpMessageConverter Jun 27, 2019
sbrannen added a commit that referenced this issue Jun 27, 2019
This commit changes the new addSupportedMediaType(MediaType) method
to addSupportedMediaTypes(MediaType...), in order to allow registration
of multiple supported media types simultaneously.

See gh-23203
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