diff --git a/CHANGES.txt b/CHANGES.txt index 50362cde83..8cc3a75049 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -10,6 +10,10 @@ Trunk (unreleased changes) hadoop-config.sh so that it allows setting java command options for JAVA_PLATFORM. (Koji Noguchi via szetszwo) + HADOOP-6337. Updates FilterInitializer class to be more visible, + and the init of the class is made to take a Configuration argument. + (Jakob Homan via ddas) + IMPROVEMENTS HADOOP-6283. Improve the exception messages thrown by diff --git a/src/java/org/apache/hadoop/http/FilterInitializer.java b/src/java/org/apache/hadoop/http/FilterInitializer.java index 3f4765e29b..c8d6ae6dde 100644 --- a/src/java/org/apache/hadoop/http/FilterInitializer.java +++ b/src/java/org/apache/hadoop/http/FilterInitializer.java @@ -17,6 +17,8 @@ */ package org.apache.hadoop.http; +import org.apache.hadoop.conf.Configuration; + /** * Initialize a javax.servlet.Filter. */ @@ -24,6 +26,7 @@ public abstract class FilterInitializer { /** * Initialize a Filter to a FilterContainer. * @param container The filter container + * @param conf Configuration for run-time parameters */ - abstract void initFilter(FilterContainer container); + public abstract void initFilter(FilterContainer container, Configuration conf); } \ No newline at end of file diff --git a/src/java/org/apache/hadoop/http/HttpServer.java b/src/java/org/apache/hadoop/http/HttpServer.java index 07a4339596..0822af2415 100644 --- a/src/java/org/apache/hadoop/http/HttpServer.java +++ b/src/java/org/apache/hadoop/http/HttpServer.java @@ -127,7 +127,7 @@ public HttpServer(String name, String bindAddress, int port, final FilterInitializer[] initializers = getFilterInitializers(conf); if (initializers != null) { for(FilterInitializer c : initializers) { - c.initFilter(this); + c.initFilter(this, conf); } } addDefaultServlets(); diff --git a/src/test/core/org/apache/hadoop/http/TestGlobalFilter.java b/src/test/core/org/apache/hadoop/http/TestGlobalFilter.java index 51b43120b1..35a50e5e5d 100644 --- a/src/test/core/org/apache/hadoop/http/TestGlobalFilter.java +++ b/src/test/core/org/apache/hadoop/http/TestGlobalFilter.java @@ -68,7 +68,7 @@ public void doFilter(ServletRequest request, ServletResponse response, static public class Initializer extends FilterInitializer { public Initializer() {} - void initFilter(FilterContainer container) { + public void initFilter(FilterContainer container, Configuration conf) { container.addGlobalFilter("recording", RecordingFilter.class.getName(), null); } } diff --git a/src/test/core/org/apache/hadoop/http/TestServletFilter.java b/src/test/core/org/apache/hadoop/http/TestServletFilter.java index 7d4198d2a3..73073f7627 100644 --- a/src/test/core/org/apache/hadoop/http/TestServletFilter.java +++ b/src/test/core/org/apache/hadoop/http/TestServletFilter.java @@ -66,7 +66,7 @@ public void doFilter(ServletRequest request, ServletResponse response, static public class Initializer extends FilterInitializer { public Initializer() {} - void initFilter(FilterContainer container) { + public void initFilter(FilterContainer container, Configuration conf) { container.addFilter("simple", SimpleFilter.class.getName(), null); } }