当前位置 : 主页 > 编程语言 > c++ >

java允许跨域设置

来源:互联网 收集:自由互联 发布时间:2021-07-03
gistfile1.txt @ResponseBody@RequestMapping(value="/queryUserAjax", method={RequestMethod.GET,RequestMethod.POST})public Map queryUserAjax(HttpServletRequest request, HttpServletResponse response) throws SQLException {Map list = this.userSer
gistfile1.txt
@ResponseBody
	@RequestMapping(value="/queryUserAjax", method={RequestMethod.GET,RequestMethod.POST})
	public Map
 
   queryUserAjax(HttpServletRequest request, HttpServletResponse response) throws SQLException {
		Map
  
    list = this.userService.queryUser(); System.out.println(request); // response.setHeader("Access-Control-Allow-Origin", "http://192.168.100.23:8020"); response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS"); response.setHeader("Access-Control-Max-Age", "3600"); response.addHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); return list; }
  
 
网友评论