ソースを参照

HADOOP-4572. Can not access user logs - Jetty is not configured by default to serve aliases/symlinks (ahmed via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1376757 13f79535-47bb-0310-9956-ffa450edef68
Alejandro Abdelnur 13 年 前
コミット
fef2bd217f

+ 3 - 0
CHANGES.txt

@@ -194,6 +194,9 @@ Release 1.2.0 - unreleased
 
     HDFS-3846. Namenode deadlock in branch-1. (Brandon Li via jitendra)
 
+    HADOOP-4572. Can not access user logs - Jetty is not configured by default 
+    to serve aliases/symlinks (ahmed via tucu)
+
 Release 1.1.0 - unreleased
 
   INCOMPATIBLE CHANGES

+ 9 - 0
src/core/core-default.xml

@@ -577,4 +577,13 @@
   </description>
 </property>
 
+<property>
+  <name>hadoop.jetty.logs.serve.aliases</name>
+  <value>true</value>
+  <description>
+    Enable/Disable aliases serving from jetty
+  </description>
+</property>
+
+
 </configuration>

+ 6 - 0
src/core/org/apache/hadoop/fs/CommonConfigurationKeys.java

@@ -73,5 +73,11 @@ public class CommonConfigurationKeys {
   public static final String HADOOP_RELAXED_VERSION_CHECK_KEY =
       "hadoop.relaxed.worker.version.check";
   public static final boolean HADOOP_RELAXED_VERSION_CHECK_DEFAULT = false;
+
+  /** Enable/Disable aliases serving from jetty */
+  public static final String HADOOP_JETTY_LOGS_SERVE_ALIASES =
+    "hadoop.jetty.logs.serve.aliases";
+  public static final boolean DEFAULT_HADOOP_JETTY_LOGS_SERVE_ALIASES =
+    true;
 }
 

+ 6 - 0
src/core/org/apache/hadoop/http/HttpServer.java

@@ -240,6 +240,12 @@ public class HttpServer implements FilterContainer {
       Context logContext = new Context(parent, "/logs");
       logContext.setResourceBase(logDir);
       logContext.addServlet(AdminAuthorizedServlet.class, "/");
+      if (conf.getBoolean(
+          CommonConfigurationKeys.HADOOP_JETTY_LOGS_SERVE_ALIASES,
+          CommonConfigurationKeys.DEFAULT_HADOOP_JETTY_LOGS_SERVE_ALIASES)) {
+        logContext.getInitParams().put(
+            "org.mortbay.jetty.servlet.Default.aliases", "true");
+      }
       logContext.setDisplayName("logs");
       setContextAttributes(logContext);
       defaultContexts.put(logContext, true);