Spring 3.0 HEAD Requests

前端 未结 3 959
广开言路
广开言路 2021-01-03 23:35

recently we moved to spring 3.0 Controller handling like this:

@Controller
public class MyController {
   @RequestMapping(method = RequestMethod.POST)
   pro         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 00:00

    Just add HEAD as a supported method the the request mapping:

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.HEAD})
    

    Update: I think you can provide a custom class that extends AnnotationMethodHandlerAdapter to be the method handler (in dispatcher-servlet.xml), and just bypass the HEAD support check there. But I'd just use the replace features of an IDE to add it.

提交回复
热议问题