Expected Behavior
Grails core should not silently fall back to createDefaults() in getMimeTypes() — when there's no request, it should defer caching, not poison it.
org.grails.web.mime.HttpServletResponseExtension.getMimeTypes()
public static MimeType[] getMimeTypes() {
if (mimeTypes == null) { // ← static field, populated once
webRequest = GrailsWebRequest.lookup(); // ← thread-local request lookup
ApplicationContext ctx = webRequest?.getApplicationContext();
if (ctx != null) {
// CORRECT PATH: read app config via Spring
mimeTypes = ctx.getBean(MimeUtility).getKnownMimeTypes();
loadMimeTypeConfig(ctx.getBean(GrailsApplication).config);
} else {
// WRONG-FALLBACK PATH:
mimeTypes = MimeType.createDefaults(); // [XHTML, HTML, XML, ...]
}
}
return mimeTypes;
}
Actual Behaviour
No response
Steps To Reproduce
No response
Environment Information
No response
Example Application
No response
Version
7.0.10
Expected Behavior
Grails core should not silently fall back to createDefaults() in getMimeTypes() — when there's no request, it should defer caching, not poison it.
org.grails.web.mime.HttpServletResponseExtension.getMimeTypes()Actual Behaviour
No response
Steps To Reproduce
No response
Environment Information
No response
Example Application
No response
Version
7.0.10