- 
                Notifications
    You must be signed in to change notification settings 
- Fork 38.8k
Description
Edward Sargisson opened SPR-8862 and commented
I am attempting to seemlessly handle requests for KML files from Google Maps API and return a gzip version when requested. Google Maps puts 'accept-encoding = gzip' into the header.
I have the following code:
@RequestMapping(value = "/course/{courseIdParam}.kml", method=RequestMethod.GET, headers="Accept-Encoding!=gzip")
@ResponseBodypublic void getCourseAsKml(@PathVariable final String courseIdParam, final ModelMap modelMap, final OutputStream outputStream, final HttpServletResponse response, final HttpServletRequest request) throws JAXBException, IOException {
}
@RequestMapping(value = "/course/{courseIdParam}.kml", method=RequestMethod.GET, headers="Accept-Encoding=gzip")
@ResponseBodypublic void getCourseAsKmz(@PathVariable final String courseIdParam, final ModelMap modelMap, final OutputStream outputStream, final HttpServletResponse response, final HttpServletRequest request) throws JAXBException, IOException {
}
Expected behaviour:
getCourseAsKmz should be called.
getCourseAsKml should not be called
Actual behaviour:
getCourseAsKml is called
I believe the problem is in ServletAnnotationMappingUtils.checkHeaders
else if (!value.equals(request.getHeader(key))) {
return negated;
}
I think the ! needs to be removed from the condition
Affects: 3.1 RC1