deniskuzZ commented on code in PR #5652: URL: https://github.com/apache/hive/pull/5652#discussion_r2014594964
########## 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: should we do this closer to actual ref usage? -- 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