2013년 10월 17일 목요일

[참고] ajax cross domain 해결

http://webtn.tistory.com/entry/javascriptCross-Domain-%EA%B9%A8%EB%B6%80%EC%88%98%EA%B8%B0


필터 추가
"Access-Control-Allow-Origin"


@WebFilter("*")
public class AjaxFilter implements Filter {

@Override
public void destroy() {}

@Override
public void doFilter(
ServletRequest request,
ServletResponse response,
FilterChain next) throws IOException, ServletException {

HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setHeader("Access-Control-Allow-Origin", "*");

next.doFilter(request, response);
}

@Override
public void init(FilterConfig arg0) throws ServletException {}

}

댓글 없음:

댓글 쓰기