code: public static String resolveUrl(String genericUrl, MessageParameters parameters) {
  		Preconditions.checkState(parameters.isResolved(), "Not all mandatory message parameters were resolved.");
  		StringBuilder path = new StringBuilder(genericUrl);
  		StringBuilder queryParameters = new StringBuilder();
  
  		for (MessageParameter<?> pathParameter : parameters.getPathParameters()) {
  			if (pathParameter.isResolved()) {
  				int start = path.indexOf(':' + pathParameter.getKey());
  
  				final String pathValue = Preconditions.checkNotNull(pathParameter.getValueAsString());
  
  				// only replace path parameters if they are present
  				if (start != -1) {
  					path.replace(start, start + pathParameter.getKey().length() + 1, pathValue);
  				}
  			}
  		}
  		boolean isFirstQueryParameter = true;
  		for (MessageQueryParameter<?> queryParameter : parameters.getQueryParameters()) {
  			if (queryParameter.isResolved()) {
  				if (isFirstQueryParameter) {
  					queryParameters.append('?');
  					isFirstQueryParameter = false;
  				} else {
  					queryParameters.append('&');
  				}
  				queryParameters.append(queryParameter.getKey());
  				queryParameters.append('=');
  				queryParameters.append(queryParameter.getValueAsString());
  			}
  		}
  		path.append(queryParameters);
  
  		return path.toString();
  	}
docs: Resolves the given URL (e.g "jobs/:jobid") using the given path/query parameters.
  
  <p>This method will fail with an {@link IllegalStateException} if any mandatory parameter was not resolved.
  
  <p>Unresolved optional parameters will be ignored.
  
  @param genericUrl URL to resolve
  @param parameters message parameters parameters
  @return resolved url, e.g "/jobs/1234?state=running"
  @throws IllegalStateException if any mandatory parameter was not resolved