Skip to content

Add "application/wasm" to MimeMappings #17254

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

Closed
ememisya opened this issue Jun 18, 2019 · 4 comments
Closed

Add "application/wasm" to MimeMappings #17254

ememisya opened this issue Jun 18, 2019 · 4 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@ememisya
Copy link

Please prepend:

mappings.add("wasm", "application/wasm");

To the indicated line. Currently I'm handling recognition of the wasm payload as such:

@Component
public class ServletCustomizer implements EmbeddedServletContainerCustomizer
{

  @Override
  public void customize(final ConfigurableEmbeddedServletContainer container)
  {
    final MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    mappings.add("wasm", "application/wasm");
    container.setMimeMappings(mappings);
  }
}

Thank you for your time!

See (https://webassembly.org/docs/web/) for further details on the type.

This compilation can be performed in the background and in a streaming manner. If the Response is not CORS-same-origin, does not represent an ok status, or does not match the application/wasm MIME type, the returned promise will be rejected with a TypeError;

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 18, 2019
@philwebb philwebb added the for: team-attention An issue we'd like other members of the team to review label Jun 18, 2019
@wilkinsona
Copy link
Member

wilkinsona commented Jun 19, 2019

I don't think we should make this addition, for the same reasons as #6022:

We need to draw the line somewhere as each mapping that we configure has a small cost so we configure the three embedded containers that we support (Tomcat, Jetty, and Undertow) with the union of the mime mappings that each of those containers provides by default. Put another way, none of the supported containers provides a mapping for eot or ttf by default so Spring Boot doesn't either.

Further to this, from Mark Thomas, Tomcat uses Apache HTTPD's mappings as the source for its mappings. At the time of writing, HTTPD does not have a mapping for application/wasm either.

@ememisya
Copy link
Author

WebAssembly isn't going anywhere nor is the standard changing anytime soon. As referenced the mime-type is required by the standard (see referenced part of documentation). Soon enough everybody who implements wasm will require it and it will need to be added much like application/json as json wasn't going anywhere either.

@philwebb
Copy link
Member

I think we should continue to drive the contents of MimeMappings from the choices that the upstream servlet containers make. They are in a much better position than us to make these kinds of decisions. We also already have tests in place to ensure that our MimeMappings includes all of those supported by Tomcat, Undertow and Jetty.

@ememisya Feel free to raise an issue on the Tomcat issue tracker for this. If it's accepted there, we'll pick it up here in due course.

@philwebb philwebb added status: declined A suggestion or change that we don't feel we should currently apply and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels Jun 19, 2019
@ememisya
Copy link
Author

ememisya commented Jun 19, 2019

As it turns out the media type is currently still in provisional status as per IANA ( https://www.iana.org/assignments/media-types/media-types.xhtml ).

See:
WebAssembly/design#1202

Apparently this is also what Apache is waiting on at this time. I'll keep an eye on it, thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

4 participants