protected static boolean appendParams ( StringBuilder SB , Object optParam , List < String > finishedParams , boolean alreadyAppended ) { if ( optParam != null ) { if ( optParam instanceof String ) { List < String > nameValuePairs = StringUtility . splitString ( ( String ) optParam , ' ' ) ; int len = nameValuePairs . size ( ) ; for ( int i = 0 ; i < len ; i ++ ) { SB . append ( alreadyAppended ? ' ' : ' ' ) ; String S = nameValuePairs . get ( i ) ; int pos = S . indexOf ( ' ' ) ; if ( pos == - 1 ) { SB . append ( S ) ; alreadyAppended = true ; } else { String name = S . substring ( 0 , pos ) ; if ( ! finishedParams . contains ( name ) ) { SB . append ( S ) ; finishedParams . add ( name ) ; alreadyAppended = true ; } } } } else if ( optParam instanceof String [ ] ) { String [ ] SA = ( String [ ] ) optParam ; int len = SA . length ; for ( int c = 0 ; c < len ; c += 2 ) { String name = SA [ c ] ; if ( ! finishedParams . contains ( name ) ) { SB . append ( alreadyAppended ? ' ' : ' ' ) . append ( name ) . append ( ' ' ) . append ( SA [ c + 1 ] ) ; finishedParams . add ( name ) ; alreadyAppended = true ; } } } else throw new IllegalArgumentException ( "Unsupported type for optParam: " + optParam . getClass ( ) . getName ( ) ) ; } return alreadyAppended ; }
Appends the parameters to a URL . Parameters should already be URL encoded but not XML encoded .