Here you can find the source of encodeForm(Map
public static String encodeForm(Map<String, Object> form)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Map; import java.util.Map.Entry; public class Main { public static String encodeForm(Map<String, Object> form) { try {/*w ww. ja v a 2s. c o m*/ StringBuilder result = new StringBuilder(); for (Entry<String, Object> argument : form.entrySet()) { result.append(URLEncoder.encode(argument.getKey(), "UTF-8")); result.append('='); result.append(URLEncoder.encode(String.valueOf(argument.getValue()), "UTF-8")); result.append('&'); } result.deleteCharAt(result.length() - 1); return result.toString(); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } } }