C0urante commented on code in PR #13137: URL: https://github.com/apache/kafka/pull/13137#discussion_r1090935837
########## 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: It's the result of fitting a square peg (Java's `URLEncoder` class, which, despite the name, is designed for HTML form encoding instead of URL path encoding) into a round hole (URL path encoding). I couldn't find a better alternative than this, and considering the fairly low risk and integration test coverage, figured it'd be good enough for now. -- 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