NihalJain commented on code in PR #5586:
URL: https://github.com/apache/hbase/pull/5586#discussion_r1428946667


##########
hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java:
##########
@@ -770,6 +766,37 @@ protected void addDefaultApps(ContextHandlerCollection 
parent, final String appD
     defaultContexts.put(staticContext, true);
   }
 
+  /**
+   * This method configures the alias checks for the given 
ServletContextHandler based on the
+   * provided value of shouldServeAlias.<br>
+   * If the configuration allows serving aliases, it checks if 
SymlinkAllowedResourceAliasChecker is
+   * already a part of the alias check list.<br>
+   * If not, it adds it to the list. If it is already a part of the list, no 
changes are made.<br>
+   * If the configuration does not allow serving aliases, it clears all alias 
checks from the
+   * ServletContextHandler.<br>
+   * .
+   * @param context          The ServletContextHandler whose alias checks are 
to be configured
+   * @param shouldServeAlias Whether aliases should be allowed or not
+   */
+  private void configureAliasChecks(ServletContextHandler context, boolean 
shouldServeAlias) {
+    if (shouldServeAlias) {
+      Class aliasCheckerClass = SymlinkAllowedResourceAliasChecker.class;
+      // check if SymlinkAllowedResourceAliasChecker is already part of alias 
check list
+      // NOTE: we are doing this because by default this is already present in 
the context
+      if 
(!context.getAliasChecks().stream().anyMatch(aliasCheckerClass::isInstance)) {

Review Comment:
   simplify and switch IF/ELSE conditions check by removing NOT



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to