@Test void url() { HashMap<String, String> map = new LinkedHashMap<>(); map.put("hello", "world"); map.put(null, "value"); map.put("B& B", "yes"); map.put("empty", null); assertEquals("hello=world&B%26%20B=yes&empty=", this.tool.url(map)); }
public String url(Map<String, ?> parametersMap) { StringBuilder queryStringBuilder = new StringBuilder(); for (Map.Entry<String, ?> entry : parametersMap.entrySet()) { if (entry.getKey() == null) { continue; } String cleanKey = this.url(entry.getKey()); Object mapValues = entry.getValue(); if (mapValues != null && mapValues.getClass().isArray()) { Object[] values = (Object[]) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else if (mapValues != null && Collection.class.isAssignableFrom(mapValues.getClass())) { Collection<?> values = (Collection<?>) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else { addQueryStringPair(cleanKey, mapValues, queryStringBuilder); } } return queryStringBuilder.toString(); }
EscapeTool extends org.apache.velocity.tools.generic.EscapeTool { public String url(Map<String, ?> parametersMap) { StringBuilder queryStringBuilder = new StringBuilder(); for (Map.Entry<String, ?> entry : parametersMap.entrySet()) { if (entry.getKey() == null) { continue; } String cleanKey = this.url(entry.getKey()); Object mapValues = entry.getValue(); if (mapValues != null && mapValues.getClass().isArray()) { Object[] values = (Object[]) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else if (mapValues != null && Collection.class.isAssignableFrom(mapValues.getClass())) { Collection<?> values = (Collection<?>) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else { addQueryStringPair(cleanKey, mapValues, queryStringBuilder); } } return queryStringBuilder.toString(); } }
EscapeTool extends org.apache.velocity.tools.generic.EscapeTool { public String url(Map<String, ?> parametersMap) { StringBuilder queryStringBuilder = new StringBuilder(); for (Map.Entry<String, ?> entry : parametersMap.entrySet()) { if (entry.getKey() == null) { continue; } String cleanKey = this.url(entry.getKey()); Object mapValues = entry.getValue(); if (mapValues != null && mapValues.getClass().isArray()) { Object[] values = (Object[]) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else if (mapValues != null && Collection.class.isAssignableFrom(mapValues.getClass())) { Collection<?> values = (Collection<?>) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else { addQueryStringPair(cleanKey, mapValues, queryStringBuilder); } } return queryStringBuilder.toString(); }  }
EscapeTool extends org.apache.velocity.tools.generic.EscapeTool { public String url(Map<String, ?> parametersMap) { StringBuilder queryStringBuilder = new StringBuilder(); for (Map.Entry<String, ?> entry : parametersMap.entrySet()) { if (entry.getKey() == null) { continue; } String cleanKey = this.url(entry.getKey()); Object mapValues = entry.getValue(); if (mapValues != null && mapValues.getClass().isArray()) { Object[] values = (Object[]) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else if (mapValues != null && Collection.class.isAssignableFrom(mapValues.getClass())) { Collection<?> values = (Collection<?>) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else { addQueryStringPair(cleanKey, mapValues, queryStringBuilder); } } return queryStringBuilder.toString(); }  @Override String xml(Object content); String json(Object string); String quotedPrintable(Object content); String q(Object content); String b(Object content); String url(Map<String, ?> parametersMap); String css(String identifier); @Override String url(Object string); }
EscapeTool extends org.apache.velocity.tools.generic.EscapeTool { public String url(Map<String, ?> parametersMap) { StringBuilder queryStringBuilder = new StringBuilder(); for (Map.Entry<String, ?> entry : parametersMap.entrySet()) { if (entry.getKey() == null) { continue; } String cleanKey = this.url(entry.getKey()); Object mapValues = entry.getValue(); if (mapValues != null && mapValues.getClass().isArray()) { Object[] values = (Object[]) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else if (mapValues != null && Collection.class.isAssignableFrom(mapValues.getClass())) { Collection<?> values = (Collection<?>) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else { addQueryStringPair(cleanKey, mapValues, queryStringBuilder); } } return queryStringBuilder.toString(); }  @Override String xml(Object content); String json(Object string); String quotedPrintable(Object content); String q(Object content); String b(Object content); String url(Map<String, ?> parametersMap); String css(String identifier); @Override String url(Object string);  }