http跨域设置
开发http接口需要进行跨域支持:
在被请求的Response header中加入
// 指定允许其他域名访问
response.setHeader("Access-Control-Allow-Origin", "*");
// 响应头设置
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,Content-Type,token");
// 响应类型
response.setHeader("Access-Control-Allow-Methods","POST,GET,DELETE,PUT,OPTIONS");
response.setHeader("Content-Type", "application/json;charset=utf-8");