其他分享
首页 > 其他分享> > 快速开发框架的跨域问题

快速开发框架的跨域问题

作者:互联网

SDF的跨域问题

ErrorToNotFoundDispatcherServlet,修正为:

    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method = req.getMethod();
        //if (method.equals(METHOD_GET) || method.equals(METHOD_POST)|| method.equals("OPTIONS")) {
            //System.out.println(1);
            resp.setHeader("Access-Control-Allow-Origin","*");
            resp.setHeader("Access-Control-Allow-Headers", "*");
            resp.setHeader("Access-Control-Allow-Credentials", "true");
            resp.setHeader("aut","code bad");
            super.service(req, resp);
//        } else {
//            //System.out.println(2);
//            resp.setHeader("Access-Control-Allow-Origin","*");
//            resp.setHeader("aut","code bad");
//            String errMsg = lStrings.getString("http.method_not_implemented");
//            resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, MessageFormat.format(errMsg, method));
//        }
    }

标签:Control,跨域,框架,resp,Access,Allow,快速,method,setHeader
来源: https://www.cnblogs.com/luminji/p/kuai-su-kai-fa-kuang-jia-de-kua-yu-wen-ti.html