protected static String URLencodedSunQueryParamsString(String queryParams,String encoding){
  StringBuilder sb=new StringBuilder(400);
  StringTokenizer st=new StringTokenizer(queryParams,"&");
  while (st.hasMoreTokens()) {
    String str=st.nextToken();
    if (str.indexOf("=") != -1) {
      int index=str.indexOf("=");
      String parameter=str.substring(0,index);
      String value=str.substring(index + 1);
      if (parameter.equalsIgnoreCase("realm") || parameter.equalsIgnoreCase("org") || parameter.equalsIgnoreCase("module")) {
        value=getCharDecodedField(value,encoding);
      }
      sb.append(URLEncDec.encode(parameter));
      sb.append("=");
      sb.append(URLEncDec.encode(value));
      if (st.hasMoreTokens()) {
        sb.append("&");
      }
    }
  }
  return sb.toString();
}

protected static String URLencodedSunQueryParamsString ( String queryParams , String encoding ) { StringBuilder sb = new StringBuilder ( 400 ) ; StringTokenizer st = new StringTokenizer ( queryParams , "&" ) ; while ( st . hasMoreTokens ( ) ) { String str = st . nextToken ( ) ; if ( str . indexOf ( "=" ) != - 1 ) { int index = str . indexOf ( "=" ) ; String parameter = str . substring ( 0 , index ) ; String value = str . substring ( index + 1 ) ; if ( parameter . equalsIgnoreCase ( "realm" ) || parameter . equalsIgnoreCase ( "org" ) || parameter . equalsIgnoreCase ( "module" ) ) { value = getCharDecodedField ( value , encoding ) ; } sb . append ( URLEncDec . encode ( parameter ) ) ; sb . append ( "=" ) ; sb . append ( URLEncDec . encode ( value ) ) ; if ( st . hasMoreTokens ( ) ) { sb . append ( "&" ) ; } } } return sb . toString ( ) ; }
this method takes in a string representing base64 decoded sunqueryparamsstring and url encodes all the parameters included in its value
