1.若不对c参数和d参数进行URL编码则需要选择implementation为java;
2.若想不设implementation值,则需进行c参数d参数URLEncoding
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 import java.io.UnsupportedEncodingException; 2 import java.net.URLEncoder; 3 public static String UrlEncode(String result) throws UnsupportedEncodingException{ 4 StringBuffer urle = new StringBuffer(); 5 String[] results = result.split("&"); 6 int i = 0; 7 for(String tempStr : results) 8 { 9 int start = tempStr.indexOf("{"); 10 int end = tempStr.lastIndexOf("}")+1; 11 //要urlencode的字符串组合 12 String str = tempStr.substring(start, end); 13 String key = tempStr.replace(str, ""); 14 //urlencode的消息体 15 String data = URLEncoder.encode(str, "UTF-8"); 16 if(i > 0) 17 { 18 urle.append("&"); 19 } 20 urle.append(key); 21 urle.append(data); 22 i++; 23 } 24 return urle.toString(); 25 } 26 String req = UrlEncode(Parameters); 27 log.info(req); 28 vars.put("req",req);
方法二(优化):