-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Alignment of MimeMappings with Tomcat's defaults #32101
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
Conversation
We need to double check that |
Thanks for your feedback @snicoll . I've also considered updating the list directly in the code, but since there are so many mappings (1000+), maybe it's easier to maintain using a properties file. |
Also did we consider Andy's comment in the linked issue?
|
I think that may have referred to the idea that loading properties from a file might be better than having a large static block in the class. One advantage of the file is we could load it on demand then let it get garbage collected. Another, more complex idea would be to override Either way, I generally think having the mappings in a file opens up more options to us. |
Update `MimeMappings` to align with the default values used in Tomcat. The mime mapping are now loaded from a properties file and a test has been added to ensure that they remain in sync with Tomcat's defaults. See gh-32101
Refine `MimeMappings` so that common default mappings are included by default and the complete set is only loaded when needed. The `TomcatServletWebServerFactory` has been updated so that if `TomcatEmbeddedContext` is in use the mime mapping are used directly rather than being copied to another Map. The `AbstractServletWebServerFactory` class has also been changed to use a lazy copy of the mappings. This should mean that the complete set of properties is only loaded if the user mutates the mappings. See gh-32101
Thanks @terminux, this is now in main along with some refinements that should hopefully reduce memory usage for Tomcat users that aren't doing anything exotic. |
Update COMMON_MAPPINGS to align with the properties file and change the test so that it consistently works. See gh-32101
Hi, this PR is used to solve #31171 .
Migrate default mime mappings maintained in
MimeMappings
into properties fileLoad
org/apache/catalina/startup/MimeTypeMappings.properties
and assert that each entry has an override.Closes gh-31171