所以我已经阅读了有关此问题的其他线程,但没有找到解决方案。
我遇到的问题是因为我设置“access-control-allow-methods”“true”我无法使用setHeader("Access-Control-Allow-Origin", "*");
我需要设置两个特定的域...任何帮助将不胜感激。
public class CorsInterceptor implements ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
throws IOException {
//When we send the http-only cookie the 'Access-Control-Allow-Origin' header cannot be *
responseContext.getHeaders().putSingle("Access-Control-Allow-Origin", requestContext.getHeaderString("origin"));
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)