use of org.apache.druid.java.util.common.StringUtils in project druid by druid-io.
the class TaskRunnerUtils method makeWorkerURL.
public static URL makeWorkerURL(Worker worker, String pathFormat, String... pathParams) {
Preconditions.checkArgument(pathFormat.startsWith("/"), "path must start with '/': %s", pathFormat);
final String path = StringUtils.format(pathFormat, Arrays.stream(pathParams).map(StringUtils::urlEncode).toArray());
try {
return new URI(StringUtils.format("%s://%s%s", worker.getScheme(), worker.getHost(), path)).toURL();
} catch (URISyntaxException | MalformedURLException e) {
throw new RuntimeException(e);
}
}
Aggregations