difin commented on code in PR #5652: URL: https://github.com/apache/hive/pull/5652#discussion_r2015078817
########## common/src/java/org/apache/hive/http/HttpServer.java: ########## @@ -604,108 +715,65 @@ void setContextAttributes(Context ctx, Map<String, Object> contextAttrs) { private void createWebServer(final Builder b) throws IOException { // Create the thread pool for the web server to handle HTTP requests - QueuedThreadPool threadPool = new QueuedThreadPool(); + threadPool = new QueuedThreadPool(); if (b.maxThreads > 0) { threadPool.setMaxThreads(b.maxThreads); } threadPool.setDaemon(true); threadPool.setName(b.name + "-web"); this.webServer = new Server(threadPool); - this.appDir = getWebAppsPath(b.name); - this.webAppContext = createWebAppContext(b); - - if (b.useSPNEGO) { - // Secure the web server with kerberos - setupSpnegoFilter(b, webAppContext); - } - - if (b.enableCORS) { - setupCORSFilter(b); - } - - Map<String, String> xFrameParams = setHeaders(); - if (b.xFrameEnabled) { - setupXframeFilter(b,xFrameParams); - } - - if (b.disableDirListing) { - disableDirectoryListingOnServlet(webAppContext); - } + this.webAppContexts = new LinkedList<>(); - initializeWebServer(b, threadPool.getMaxThreads()); + initializeWebServer(b); } - private void initializeWebServer(final Builder b, int queueSize) throws IOException { + private void initializeWebServer(final Builder b) throws IOException { // Set handling for low resource conditions. final LowResourceMonitor low = new LowResourceMonitor(webServer); low.setLowResourcesIdleTimeout(10000); webServer.addBean(low); - Connector connector = createChannelConnector(queueSize, b); - webServer.addConnector(connector); - - RewriteHandler rwHandler = new RewriteHandler(); - rwHandler.setRewriteRequestURI(true); - rwHandler.setRewritePathInfo(false); - - RewriteRegexRule rootRule = new RewriteRegexRule(); - rootRule.setRegex("^/$"); - rootRule.setReplacement(b.contextRootRewriteTarget); - rootRule.setTerminating(true); - - rwHandler.addRule(rootRule); - rwHandler.setHandler(webAppContext); - - // Configure web application contexts for the web server - ContextHandlerCollection contexts = new ContextHandlerCollection(); - contexts.addHandler(rwHandler); - webServer.setHandler(contexts); + // Configure the global context handler + portHandlerWrapper = new PortHandlerWrapper(); + webServer.setHandler(portHandlerWrapper); + // Configure the web server connector and port handler to listen on + ContextHandlerCollection portHandler = addWebApp(b); Review Comment: I could move it only a few lines below and added a comment: ``` // Configures the web server connector and port handler to listen on // Also creates and adds the web application context to the server to which the servlets will be added ContextHandlerCollection portHandler = createAndAddWebApp(b); addServlet("jmx", "/jmx", JMXJsonServlet.class); addServlet("conf", "/conf", ConfServlet.class); addServlet("stacks", "/stacks", StackServlet.class); addServlet("conflog", "/conflog", Log4j2ConfiguratorServlet.class); ``` -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org