public void setFormParams ( TreeSet < HtmlParameter > postParams ) { if ( postParams . isEmpty ( ) ) { this . setBody ( "" ) ; return ; } StringBuilder postData = new StringBuilder ( ) ; for ( HtmlParameter parameter : postParams ) { if ( parameter . getType ( ) != HtmlParameter . Type . form ) { continue ; } postData . append ( parameter . getName ( ) ) ; postData . append ( ' ' ) ; postData . append ( parameter . getValue ( ) ) ; postData . append ( ' ' ) ; } String data = "" ; if ( postData . length ( ) != 0 ) { data = postData . substring ( 0 , postData . length ( ) - 1 ) ; } this . setBody ( data ) ; }
Construct a HTTP POST Body from the variables in postParams