java后台获取URL带参demo

URL:http://aos.wall.youmi.net/v2/check_fb_sig?order=YM130402cygr_UTb42&app=30996ced018a2a5e&ad=KC%E7%BD%91%E7%BB%9C%E7%94%B5%E8%AF%9D&user=1141058&device=50ead626ae6e&chn=0&points=7&time=1364890524&sig=15b3dfe0&adid=100&pkg=abc

获取到的parameter为:
order=YM130402cygr_UTb42&app=30996ced018a2a5e&ad=KC%E7%BD%91%E7%BB%9C%E7%94%B5%E8%AF%9D&user=1141058&
device=50ead626ae6e&chn=0&points=7&time=1364890524&sig=15b3dfe0&adid=100&pkg=abc

  

java后台获取URL带参demo_第1张图片

 

SysConfigUtil.getQueryParams(parameter):如下:


public static Map getQueryParams(String url) { try { Map params = new HashMap(); for (String param : url.split("&")) { String[] pair = param.split("="); String key = URLDecoder.decode(pair[0], "UTF-8"); String value = ""; if (pair.length > 1) { value = URLDecoder.decode(pair[1], "UTF-8"); } params.put(key, value); } return params; } catch (UnsupportedEncodingException ex) { throw new AssertionError(ex); } }

  

转载于:https://www.cnblogs.com/ipetergo/p/6840041.html

你可能感兴趣的:(java后台获取URL带参demo)