Spring 3.0 HEAD Requests

前端 未结 3 977
广开言路
广开言路 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-03 23:47

    In the current Spring (4.3.10) HEAD is automatically supported:

    @RequestMapping methods mapped to "GET" are also implicitly mapped to "HEAD", i.e. there is no need to have "HEAD" explicitly declared. An HTTP HEAD request is processed as if it were an HTTP GET except instead of writing the body only the number of bytes are counted and the "Content-Length" header set.

    https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#mvc-ann-requestmapping-head-options

提交回复
热议问题