@Component
@WebFilter(urlPatterns = { "/**" }, filterName = "tokenAuthorFilter")
public class ConfigurationFilter implements Filter{
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletResponse responses = (HttpServletResponse) response;
//请求接口的域名
responses.setHeader("Access-Control-Allow-Origin", "http://www.oujin.fun");
chain.doFilter(request, response);//到下一个链
}
@Override
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
}
}