https://www.cnblogs.com/xiaobaibailongma/p/16974031.html
package org.example.controller.requestparam;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class RequestForCanShuController
{
// 只用于示例
/**
* User-Agent:浏览器信息
* 让IE能访问,让谷歌不能访问
* IE: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.73
* chrome User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36
*
* @return
*/
@RequestMapping(value = "/handle04", params={"username!=123","pwd","!age"},
headers = {"User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.73"},
produces = MediaType.APPLICATION_ATOM_XML_VALUE,consumes = MediaType.APPLICATION_JSON_VALUE)
public String handle04() {
System.out.println("handle04............被调用");
return "success";
}
}