primefaces 推送服务报Uncaught SyntaxError: Unexpected token < in JSON at position 0
2017-05-01 21:37
1066 查看
原因是使用了一个解决跨域问题的过滤器:
package com.sgpmss.myapp.core.beans; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; public class COSRFilter implements Filter { @Override public void destroy() { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { ((HttpServletResponse) response).setHeader("Access-Control-Allow-Origin", "*"); ((HttpServletResponse) response).setHeader("Access-Control-Allow-Methods", "POST,GET,OPTIONS,PUT,DELETE"); filterChain.doFilter(request, response); } @Override public void init(FilterConfig arg0) throws ServletException { } }
相关文章推荐
- 解决方法 Uncaught SyntaxError: Unexpected token < in JSON at position 0
- Javaweb中 Uncaught SyntaxError: Unexpected token o in JSON at position 1
- 【已解决】Uncaught SyntaxError: Unexpected token o in JSON at position 1
- Uncaught SyntaxError: Unexpected token < in JSON at position 0
- 【已解决】Uncaught SyntaxError: Unexpected token o in JSON at position 1
- js获取富文本编辑器的值之后报错Uncaught SyntaxError: Unexpected token 发 in JSON at position 0
- VM356:1 Uncaught SyntaxError: Unexpected token i in JSON at position 1
- VM356:1 Uncaught SyntaxError: Unexpected token i in JSON at position 1
- 关于Uncaught SyntaxError- Unexpected token o in JSON at position 1,chrome持续报错的相关解析
- 【已解决】Uncaught SyntaxError: Unexpected token in JSON at position 0
- 代码中出现:Uncaught SyntaxError: Unexpected token o in JSON at position 1
- Uncaught (in promise) SyntaxError: Unexpected token o in JSON at position 1
- angular1.5.3.min.js:116 SyntaxError: Unexpected token g in JSON at position 63
- Http status: 200 OK ajaxOptions: parsererror thrownError: SyntaxError: Unexpected token < in JSON at
- Uncaught SyntaxError: Unexpected token o in JSON at position 1
- Uncaught SyntaxError: Unexpected token o in JSON at position 1
- SyntaxError: Unexpected token s in JSON at position 111518
- Ajax报错之Unexpected token S in JSON at position
- 【Angular2】Unexpected token / in JSON at position 35
- js常见报错之Unexpected token in JSON at position