You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bad Content-Type for static resources in Spring Web Reactive [SPR-14999] #19566
A web application using Spring 5.0.0.BUILD-SNAPSHOT, Spring Boot 2.0.0.BUILD-SNAPSHOT and Spring Web Reactive does server-side rendering and needs to serve static resources, such as images and CSS style sheet files.
Server is Tomcat (though it seems to affect all servers, or at least several).
Observed Results
All static resources: images, CSSs, etc, are being served with Content-Type: application/octet-stream. This causes e.g. CSS style sheets not to be rendered by browsers:
It can be executed with mvn -U clean compile spring-boot:run. The URL shown above (http://localhost:8080/css/stsm.css) can be used for testing this issue.
Without an explicit registration this can only come from a JAF lookup, e.g. with org/springframework/mail/javamail/mime.types which is in spring-context-support. I can confirm that with spring-context-support it works. I haven't yet confirmed if a Spring Boot 1.4 web starter application has spring-context-support but I'm guessing not. In the Servlet API we can also perform a media type lookup through the ServletContext and that's probably the reason for the difference.
The question now is what the best way to address this is /cc Brian Clozel.
I can manage the spring-context-support dependency on the starter itself.
Note that we have incoming changes for this (recently rescheduled to RC1) with #19474.
Activity
spring-projects-issues commentedon Dec 9, 2016
Rossen Stoyanchev commented
Without an explicit registration this can only come from a JAF lookup, e.g. with
org/springframework/mail/javamail/mime.typeswhich is inspring-context-support. I can confirm that withspring-context-supportit works. I haven't yet confirmed if a Spring Boot 1.4 web starter application hasspring-context-supportbut I'm guessing not. In the Servlet API we can also perform a media type lookup through the ServletContext and that's probably the reason for the difference.The question now is what the best way to address this is /cc Brian Clozel.
spring-projects-issues commentedon Dec 9, 2016
Brian Clozel commented
I can manage the
spring-context-supportdependency on the starter itself.Note that we have incoming changes for this (recently rescheduled to RC1) with #19474.
Can we close this issue in favor of #19474 ?
spring-projects-issues commentedon Dec 9, 2016
Rossen Stoyanchev commented
Yes #19474 looks like a good solution and it wouldn't be necessary to have spring-context-support in the starter, or is there another reason for that?
spring-projects-issues commentedon Dec 9, 2016
Rossen Stoyanchev commented
Resolving in favor of #19474.