是否可能只在spring引导应用程序中拦截GET请求?
addPathPatterns()方法不能解决我的目的。
我想根据他们的请求方法排除或包括被截获的请求。
例如:
应用程序将接收GET、POST、PUT和DELETE请求。
发布于 2019-08-30 15:27:00
其实你可以。您将拦截所有方法,但必须使用getMethod()从请求中筛选它们。这是它的javadoc:
/**
* Returns the name of the HTTP method with which this
* request was made, for example, GET, POST, or PUT.
* Same as the value of the CGI variable REQUEST_METHOD.
*
* @return a <code>String</code>
* specifying the name
* of the method with which
* this request was made
*/
public String getMethod();https://stackoverflow.com/questions/45731965
复制相似问题