private URI makeURI ( final String service , final Map < String , String > parameters ) { try { StringBuilder queryStringBuilder = new StringBuilder ( ) ; if ( apiBaseUri . getQuery ( ) != null ) { queryStringBuilder . append ( apiBaseUri . getQuery ( ) ) . append ( "&" ) ; } queryStringBuilder . append ( "srv=" ) . append ( service ) ; for ( Map . Entry < String , String > entry : parameters . entrySet ( ) ) { queryStringBuilder . append ( "&" ) . append ( entry . getKey ( ) ) . append ( "=" ) . append ( entry . getValue ( ) ) ; } return new URI ( apiBaseUri . getScheme ( ) , apiBaseUri . getAuthority ( ) , apiBaseUri . getPath ( ) , queryStringBuilder . toString ( ) , apiBaseUri . getFragment ( ) ) ; } catch ( URISyntaxException e ) { // This shouldn't happen, but needs to be caught regardless. throw new AssertionError ( "Could not construct API URI" , e ) ; } }
Build the URI for a particular service call .