diff --git a/CHANGES.txt b/CHANGES.txt index 50362cde831..8cc3a750496 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 3f4765e29be..c8d6ae6dde7 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 07a4339596d..0822af24150 100644 --- a/src/java/org/apache/hadoop/http/HttpServer.java +++ b/src/java/org/apache/hadoop/http/HttpServer.java @@ -127,7 +127,7 @@ public class HttpServer implements FilterContainer { 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 51b43120b19..35a50e5e5da 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 class TestGlobalFilter extends junit.framework.TestCase { 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 7d4198d2a3e..73073f7627f 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 class TestServletFilter extends junit.framework.TestCase { 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); } }