private RewriteHandler createRewriteHandler(Builder builder, WebAppContext webAppContext) {
    RewriteHandler rwHandler = new RewriteHandler();
    rwHandler.setRewriteRequestURI(true);
    rwHandler.setRewritePathInfo(false);

    RewriteRegexRule rootRule = new RewriteRegexRule();
    rootRule.setRegex("^/$");
    rootRule.setReplacement(builder.contextRootRewriteTarget);
    rootRule.setTerminating(true);

    rwHandler.addRule(rootRule);
    rwHandler.setHandler(webAppContext);
    
    return rwHandler;
  }
Creates and configures a {@link RewriteHandler} that rewrites incoming request URIs 
based on predefined rules, and sets the specified {@link WebAppContext} as the 
handler for the rewritten requests.

<p>This method creates a {@link RewriteHandler} that rewrites requests to the root path
("/") to a new target URI specified by the {@code builder.contextRootRewriteTarget}. 
The URI rewrite is applied before forwarding the request to the given {@link WebAppContext}.</p>

@param builder The builder object containing configuration values, such as the 
               target for URI rewrite.
@param webAppContext The {@link WebAppContext} to which the request will be forwarded 
                     after the URI has been rewritten.
@return A {@link RewriteHandler} configured with the rewrite rule and the web application context.
common/src/java/org/apache/hive/http/HttpServer.java