viktorsomogyi commented on code in PR #13137: URL: https://github.com/apache/kafka/pull/13137#discussion_r1087986328
########## connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorMaker.java: ########## @@ -119,7 +126,16 @@ public class MirrorMaker { public MirrorMaker(MirrorMakerConfig config, List<String> clusters, Time time) { log.debug("Kafka MirrorMaker instance created"); this.time = time; - this.advertisedBaseUrl = "NOTUSED"; + if (config.enableInternalRest()) { + this.restClient = new RestClient(config); + internalServer = new MirrorRestServer(config.originals(), restClient); + internalServer.initializeServer(); + this.advertisedUrl = internalServer.advertisedUrl().toString(); + } else { + internalServer = null; + restClient = null; + this.advertisedUrl = "NOTUSED"; Review Comment: What prevents this from being null or Optional<String>? ########## connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorMaker.java: ########## @@ -255,13 +287,26 @@ private void addHerder(SourceAndTarget sourceAndTarget) { // Pass the shared admin to the distributed herder as an additional AutoCloseable object that should be closed when the // herder is stopped. MirrorMaker has multiple herders, and having the herder own the close responsibility is much easier than // tracking the various shared admin objects in this class. - // Do not provide a restClient to the DistributedHerder to indicate that request forwarding is disabled Herder herder = new DistributedHerder(distributedConfig, time, worker, kafkaClusterId, statusBackingStore, configBackingStore, - advertisedUrl, null, CLIENT_CONFIG_OVERRIDE_POLICY, sharedAdmin); + advertisedUrl, restClient, CLIENT_CONFIG_OVERRIDE_POLICY, + restNamespace, sharedAdmin); herders.put(sourceAndTarget, herder); } + private static String encodePath(String rawPath) throws UnsupportedEncodingException { + return URLEncoder.encode(rawPath, StandardCharsets.UTF_8.name()) + // Java's out-of-the-box URL encoder encodes spaces (' ') as pluses ('+'), + // and pluses as '%2B' + // But Jetty doesn't decode pluses at all and leaves them as-are in decoded + // URLs + // So to get around that, we replace pluses in the encoded URL here with '%20', + // which is the encoding that Jetty expects for spaces + // Jetty will reverse this transformation when evaluating the path parameters + // and will return decoded strings with all special characters as they were. Review Comment: Is this a Jetty bug or just some loophole in URL encoding in general? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org