web开发跨域请求头工具类

java

浏览数:28

2019-1-13


web开发跨域请求头工具类

package com.cando.util;

import javax.servlet.http.HttpServletResponse;

public class CrossDomainUtils {

    public static void crossDomain(HttpServletResponse response){
        response.setContentType("text/xml;charset=utf-8");
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Credentials", "true");
        response.setHeader("Access-Control-Allow-Methods", "*");
    }
}

相关推荐