public static String renderQueryString ( Map < String , String > q , String enc ) { StringBuilder sb = new StringBuilder ( ) ; for ( Map . Entry < String , String > e : q . entrySet ( ) ) { String name = urlEncode ( e . getKey ( ) , enc ) ; sb . append ( name ) ; if ( e . getValue ( ) != null ) { sb . append ( ' ' ) ; sb . append ( urlEncode ( e . getValue ( ) , enc ) ) ; } sb . append ( ' ' ) ; } if ( sb . length ( ) > 0 ) sb . setLength ( sb . length ( ) - 1 ) ; return sb . toString ( ) ; }
Method which creates string with parameters and its value in format URL