Spring 解析(获取)URL 参数
import org.springframework.web.util.UriComponentsBuilder; public static void main(String[] args) { String uri = "http://my.test.com/test?param1=ab¶m2=cd¶m2=ef"; MultiValueMap<String, String> parameters = UriComponentsBuilder.fromUriString(uri).build().getQueryParams(); List<String> param1 = parameters.get("param1"); List<String> param2 = parameters.get("param2"); String firstParam1 = parameters.getFirst("param1"); System.out.println("firstParam1: " + firstParam1 ); System.out.println("param1: " + param1.get(0)); System.out.println("param2: " + param2.get(0) + "," + param2.get(1)); }