//接收方式一( jeesite ssm) @RequestMapping(value = "csDemo") public @ResponseBody String csDemo(HttpServletRequest request,HttpServletResponse response,Model model) throws IOException{ SysChargeRegister sysChargeRegister = JSON.parseObject(request.getInputStream(),SysChargeRegister.class); System.out.println("sysChargeRegister.getProjectName-------------"+sysChargeRegister.getProjectName()); System.out.println("sysChargeRegistergetProjectNumbers.-------------"+sysChargeRegister.getProjectNumbers()); return "cds"; } spring-context-shiro.xml ${adminPath}/csController/csController/csDemo = anon //shiro权限 spring-mvc.xml <mvc:exclude-mapping path="${adminPath}/csController/csController/csDemo"/>//拦截设置 //接收方式二(springboot) @ResponseBody @RequestMapping(value={"/csDemo"}) public String csDemo(@RequestBody SysProject sysProject) throws Exception{ String result = ""; String projectName = sysProject.getProjectName(); String projectNumbers = sysProject.getProjectNumbers(); System.out.println("projectName-----" + projectName); System.out.println("projectNumbers-----" + projectNumbers); return result; } 在对应的shiro设置文件中,添加对应的权限 开放csDemo接口 “anon” //发送方 public static void main(String[] args) throws MalformedURLException { String url2="http://127.0.0.1:8080/csController/csController/csDemo"; JSONObject jsonObject2=new JSONObject(); jsonObject2.put("projectName","项目名=-=-=-==-="); jsonObject2.put("projectNumbers","项目编码=======-=-=-=-"); doPost2(url2,jsonObject2); } public static String doPost2(String url, JSONObject param) { HttpPost httpPost = null; String result = null; try { HttpClient client = new DefaultHttpClient(); httpPost = new HttpPost(url); if (param != null) { StringEntity se = new StringEntity(param.toString(), "utf-8"); httpPost.setEntity(se); // post方法中,加入json数据 httpPost.setHeader("Content-Type", "application/json"); } HttpResponse response = client.execute(httpPost); if (response != null) { HttpEntity resEntity = response.getEntity(); if (resEntity != null) { result = EntityUtils.toString(resEntity, "utf-8"); } } } catch (Exception ex) { ex.printStackTrace(); } return result; }