Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 6.1.2rc2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
ResourceHandler currently uses the request's path(info) to determine the mime type for a response. The attached patch first tries the file of the actual resource, and when that is null, falls back to the path.
This solves at least one particular issue. I have a site with index.html that uses http-equiv=Refresh to redirect to the servlet part of the site. The problem is that in that case the mime type is not set as though the welcome file is successfully resolved to index.html, pathinfo is empty as the request came in on /. And because the mime type is not set, Safari thinks it should just download the file (not on the first hit, as the resource isn't cached yet then, but on the next ones).
The patch fixes this. I'm not sure if this is the best way to fix it, as it is slightly more expensive to get the file and the file name (URL probably would work as well I guess). The most efficient way to solve this is probably to use the path from the resource only when the request is to the welcome file. But I'll leave that up to you guys to decide what the best one is.
I have done a fix that is inspired by yours.
I try the Resource.toString and if that fails to find a mime type I use the pathInfo