在发送请求结果前添加下面代码
this.getResponse().setHeader("Access-Control-Allow-Origin", "*");
this.getResponse().setHeader("Access-Control-Allow-Methods", "POST, GET,PUT, OPTIONS, DELETE,OPTIONS");
this.getResponse().setHeader("Access-Control-Allow-Headers", "Authorization,Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With");
//发送请求结果
this.getResponse().getWriter().print(outObj.toString());