private void initWebAppContext(Builder builder, WebAppContext webAppContext) throws IOException {
    if (builder.useSPNEGO) {
      // Secure the web server with kerberos
      setupSpnegoFilter(builder, webAppContext);
    }

    if (builder.enableCORS) {
      setupCORSFilter(builder, webAppContext);
    }

    Map<String, String> xFrameParams = setHeaders();
    if (builder.xFrameEnabled) {
      setupXframeFilter(xFrameParams, webAppContext);
    }

    if (builder.disableDirListing) {
      disableDirectoryListingOnServlet(webAppContext);
    }
  }
Initializes the {@link WebAppContext} based on the provided configuration in the {@link Builder}.
The method sets up various filters and configurations for the web application context, including
security and cross-origin resource sharing (CORS) settings, as well as header management.

<p>The method performs the following actions based on the {@code builder} configuration:</p>
<ul>
  <li>If {@code builder.useSPNEGO} is {@code true}, sets up the SPNEGO filter for Kerberos authentication.</li>
  <li>If {@code builder.enableCORS} is {@code true}, sets up the CORS filter.</li>
  <li>If {@code builder.xFrameEnabled} is {@code true}, configures the X-Frame-Options header filter.</li>
  <li>If {@code builder.disableDirListing} is {@code true}, disables directory listing on the servlet.</li>
</ul>

@param builder The {@link Builder} object containing configuration options to customize the web application context.
@param webAppContext The {@link WebAppContext} to which the request will be forwarded 
                     after the URI has been rewritten.
@throws IOException If an I/O error occurs while initializing the web application context.
common/src/java/org/apache/hive/http/HttpServer.java