protected URI buildUri ( final String path , final List < NameValuePair > queryStringParams ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( path ) ; if ( queryStringParams != null && queryStringParams . size ( ) > 0 ) { sb . append ( "?" ) . append ( URLEncodedUtils . format ( queryStringParams , "UTF-8" ) ) ; } try { return new URI ( sb . toString ( ) ) ; } catch ( final URISyntaxException e ) { throw new IllegalStateException ( "Invalid uri" , e ) ; } }
Helper method to return URI query parameters