@Test public void testGetParameters2WithDuplicatesRemove() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/category/abc/sku/xyz/category/abc/sku/xyz"); request.setQueryString("a=a1&a=a2&b=b1&a=a1&a=a2&b=b1"); Map<String, List<String>> parameters; Iterator<Map.Entry<String, List<String>>> parametersIt; Map.Entry<String, List<String>> p1, p2, p3, p4; parameters = HttpUtil.getParameters(request, Collections.emptySet(), true); assertEquals(2, parameters.size()); parametersIt = parameters.entrySet().iterator(); p1 = parametersIt.next(); assertEquals("a", p1.getKey()); assertEquals(2, p1.getValue().size()); assertEquals("a1", p1.getValue().get(0)); assertEquals("a2", p1.getValue().get(1)); p2 = parametersIt.next(); assertEquals("b", p2.getKey()); assertEquals(1, p2.getValue().size()); assertEquals("b1", p2.getValue().get(0)); parameters = HttpUtil.getParameters(request, new HashSet<>(Collections.singletonList("category")), true); assertEquals(3, parameters.size()); parametersIt = parameters.entrySet().iterator(); p1 = parametersIt.next(); assertEquals("category", p1.getKey()); assertEquals(1, p1.getValue().size()); assertEquals("abc", p1.getValue().get(0)); p2 = parametersIt.next(); assertEquals("a", p2.getKey()); assertEquals(2, p2.getValue().size()); assertEquals("a1", p2.getValue().get(0)); assertEquals("a2", p2.getValue().get(1)); p3 = parametersIt.next(); assertEquals("b", p3.getKey()); assertEquals(1, p3.getValue().size()); assertEquals("b1", p3.getValue().get(0)); parameters = HttpUtil.getParameters(request, new HashSet<>(Arrays.asList("sku", "category")), true); assertEquals(4, parameters.size()); parametersIt = parameters.entrySet().iterator(); p1 = parametersIt.next(); assertEquals("category", p1.getKey()); assertEquals(1, p1.getValue().size()); assertEquals("abc", p1.getValue().get(0)); p2 = parametersIt.next(); assertEquals("sku", p2.getKey()); assertEquals(1, p2.getValue().size()); assertEquals("xyz", p2.getValue().get(0)); p3 = parametersIt.next(); assertEquals("a", p3.getKey()); assertEquals(2, p3.getValue().size()); assertEquals("a1", p3.getValue().get(0)); assertEquals("a2", p3.getValue().get(1)); p4 = parametersIt.next(); assertEquals("b", p4.getKey()); assertEquals(1, p4.getValue().size()); assertEquals("b1", p4.getValue().get(0)); }
public static Map<String, List<String>> getParameters(final String requestURL, final Set<String> pathVariables) { return getParameters(requestURL, pathVariables, false); }
HttpUtil { public static Map<String, List<String>> getParameters(final String requestURL, final Set<String> pathVariables) { return getParameters(requestURL, pathVariables, false); } }
HttpUtil { public static Map<String, List<String>> getParameters(final String requestURL, final Set<String> pathVariables) { return getParameters(requestURL, pathVariables, false); }  }
HttpUtil { public static Map<String, List<String>> getParameters(final String requestURL, final Set<String> pathVariables) { return getParameters(requestURL, pathVariables, false); }  static String dumpRequest(final HttpServletRequest request); static String decodeUtf8UriParam(final String value); static String encodeUtf8UriParam(final String value); static Map<String, List<String>> getParameters(final String requestURL,
                                                          final Set<String> pathVariables); static Map<String, List<String>> getParameters(final String requestURL,
                                                          final Set<String> pathVariables,
                                                          final boolean removeDuplicates); static Map<String, List<String>> getParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables); static Map<String, List<String>> getParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables,
                                                          final boolean removeDuplicates); static Map<String, List<String>> allParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables); static Map<String, List<String>> allParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables,
                                                          final boolean removeDuplicates); static String getSingleValue(final Object param); static String escapeForHTML(final String raw); static String escapeForHTMLAttribute(final String raw); }
HttpUtil { public static Map<String, List<String>> getParameters(final String requestURL, final Set<String> pathVariables) { return getParameters(requestURL, pathVariables, false); }  static String dumpRequest(final HttpServletRequest request); static String decodeUtf8UriParam(final String value); static String encodeUtf8UriParam(final String value); static Map<String, List<String>> getParameters(final String requestURL,
                                                          final Set<String> pathVariables); static Map<String, List<String>> getParameters(final String requestURL,
                                                          final Set<String> pathVariables,
                                                          final boolean removeDuplicates); static Map<String, List<String>> getParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables); static Map<String, List<String>> getParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables,
                                                          final boolean removeDuplicates); static Map<String, List<String>> allParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables); static Map<String, List<String>> allParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables,
                                                          final boolean removeDuplicates); static String getSingleValue(final Object param); static String escapeForHTML(final String raw); static String escapeForHTMLAttribute(final String raw);  }