Java Utililty Methods URL Query Build

List of utility methods to do URL Query Build

Description

The list of methods to do URL Query Build are organized into topic(s).

Method

StringmapToQueryString(Map parameters, String charSet)
map To Query String
String queryString = "";
if (parameters != null && !parameters.isEmpty()) {
    Set<Entry> entrySet = parameters.entrySet();
    for (Entry entry : entrySet) {
        try {
            String key = entry.getKey().toString();
            Object value = entry.getValue();
            List values = makeStringList(value);
...
StringmapToQueryString(Map parameters, String charSet)
map To Query String
String queryString = "";
if (parameters != null && !parameters.isEmpty()) {
    for (String key : parameters.keySet()) {
        try {
            Object value = parameters.get(key);
            if (value instanceof String) {
                queryString += key + "=" + URLEncoder.encode(value == null ? "" : value.toString(), charSet)
                        + "&";
...
StringmapToQueryString(Map queryString)
map To Query String
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> e : queryString.entrySet()) {
    if (sb.length() > 0) {
        sb.append('&');
    sb.append(URLEncoder.encode(e.getKey(), ENCODING_UTF_8)).append('=')
            .append(URLEncoder.encode(e.getValue(), "UTF-8"));
return sb.toString();
StringtoQueryString(Map map)
to Query String
StringBuilder sb = new StringBuilder();
for (Map.Entry<?, ?> entry : map.entrySet()) {
    if (sb.length() > 0) {
        sb.append("&");
    sb.append(String.format("%s=%s", urlEncodeUTF8(entry.getKey().toString()),
            urlEncodeUTF8(entry.getValue().toString())));
return sb.toString();
StringtoQueryString(Map requestMap)
to Query String
String paramStr = "";
for (Map.Entry<String, String> entry : requestMap.entrySet()) {
    if (!paramStr.isEmpty()) {
        paramStr += "&";
    paramStr += entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), "UTF-8");
return paramStr;
...