jsonp+springmvc解决跨域问题

前端之家收集整理的这篇文章主要介绍了jsonp+springmvc解决跨域问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<table class="text"><tr class="li1">
<td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

required = false) String callback,                                           HttpServletResponse response) throws CustomException {         long t0 = System.currentTimeMillis();         searchType = StringUtils.trim(searchType);         searchContent = StringUtils.trim(searchContent);           if (StringUtils.isBlank(searchType) || StringUtils.isBlank(searchContent)) {             throw new CustomException("搜索条件为空");         }           log.debug("Request param [searchType]:{},[searchContent]: {} ",searchType,searchContent);           ResponseResult responseResult = new ResponseResult();         switch (searchType) {             case "身份证号":                 responseResult = graphService.selectByCertNo4Smart(searchContent);                 break;             case "姓名":                 responseResult = graphService.selectByName4Smart(searchContent);                 break; //            case "客户类型": //                graph = graphService.selectByCustType4Smart(Profile.CustType.matchDescToCode(searchContent)); //                break;             case "手机号":                 responseResult = graphService.selectByPhone4Smart(searchContent);                 break;             default:    //剩下都是根据边查找     计算出md5 然后根据 vid查找 //                String vid = MD5Utils.md5(searchType + searchContent);                 responseResult = graphService.selectByEdge4Smart(searchType,searchContent);         }           Graph graph = (Graph) responseResult.getData();         //为下文日志打印服务         if (graph == null) {             graph = new Graph(null,null);         }         log.info("Number of node: " + (graph.getNodes() == null ? 0 : graph.getNodes().size()));         log.info("Number of edge: " + (graph.getEdges() == null ? 0 : graph.getEdges().size()));           long t1 = System.currentTimeMillis();         log.info("Request processing time: " + (t1 - t0) + "ms");           //构造MappingJacksonValue,SpringMVC配合jsonp解决浏览器跨域访问问题         MappingJacksonValue mjv = new MappingJacksonValue(responseResult);         mjv.setJsonpFunction(callback);             return mjv;     } ``` 原文链接:https://www.f2er.com/springmvc/414861.html

猜你在找的SpringMVC相关文章