Here you can find the source of encodeState(Map
public static String encodeState(Map<String, String> params)
//package com.java2s; /*// w w w .jav a 2s . com * Copyright (c) 2013, Helome and/or its affiliates. All rights reserved. * Helome PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * Created on 2014-3-26 */ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Map; public class Main { public static String encodeState(Map<String, String> params) { String state = null; try { StringBuilder stateBuilder = new StringBuilder(); for (Map.Entry<String, String> e : params.entrySet()) { stateBuilder.append(URLEncoder.encode(e.getKey(), "utf-8")).append('&'); stateBuilder.append(URLEncoder.encode(e.getValue(), "utf-8")).append('&'); } if (stateBuilder.length() > 0) { stateBuilder.deleteCharAt(stateBuilder.length() - 1); } state = URLEncoder.encode(stateBuilder.toString(), "utf-8").replace('%', '_'); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } return state; } }