How to handle HTTP OPTIONS with Spring MVC?

前端 未结 5 1278
鱼传尺愫
鱼传尺愫 2020-11-29 07:28

I\'d like to intercept the OPTIONS request with my controller using Spring MVC, but it is catched by the DispatcherServlet. How can I manage that?

5条回答
  •  渐次进展
    2020-11-29 07:46

    @RequestMapping(value="/youroptions", method=RequestMethod.OPTIONS)
    public View getOptions() {
    
    }
    

    You should configure the dispatcherServlet by setting its dispatchOptionsRequest to true

提交回复
热议问题