标签:ade options col request throws app return type ati
private void returnJson(HttpServletRequest request,ServletResponse response, ResultModel ResultModel) throws IOException { //把返回值输出到客户端 HttpServletRequest httpServletRequest = (HttpServletRequest) request; HttpServletResponse httpServletResponse = (HttpServletResponse) response; httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin")); httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE"); httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers")); response.setContentType("application/json; charset=utf-8"); response.setCharacterEncoding("UTF-8"); ServletOutputStream outputStream = response.getOutputStream(); outputStream.write(JsonTools.objToJson(ResultModel).getBytes()); outputStream.flush(); outputStream.close(); }
标签:ade options col request throws app return type ati
原文地址:https://www.cnblogs.com/ynhk/p/11525409.html