ResourceHttpRequestHandler sends content without content-type header if no media type found (SPR-7713); ResourceHttpRequestHandler and ContentNegotiatingViewResolver use consistent mime type resolution
@ -109,15 +117,13 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
@@ -109,15 +117,13 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
MediaTypemediaType=getMediaType(resource);
if(mediaType!=null){
if(logger.isDebugEnabled()){
logger.debug("Determined media type ["+mediaType+"] for "+resource);
logger.debug("Determined media type '"+mediaType+"' for "+resource);
}
}
else{
if(logger.isDebugEnabled()){
logger.debug("No media type found for "+resource+" - returning 404");
logger.debug("No media type found for "+resource+" - not sending a content-type header");
@ -190,7 +196,15 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
@@ -190,7 +196,15 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
@ -207,7 +221,10 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
@@ -207,7 +221,10 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
thrownewIOException("Resource content too long (beyond Integer.MAX_VALUE): "+resource);
}
response.setContentLength((int)length);
response.setContentType(mediaType.toString());
if(mediaType!=null){
response.setContentType(mediaType.toString());
}
}
/**
@ -221,4 +238,48 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
@@ -221,4 +238,48 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
@ -407,7 +407,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
@@ -407,7 +407,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
@ -418,8 +418,14 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
@@ -418,8 +418,14 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
@ -506,6 +512,18 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
@@ -506,6 +512,18 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
@ -549,22 +567,10 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
@@ -549,22 +567,10 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport