HADOOP-6337. Updates FilterInitializer class to be more visible, and the init of the class is made to take a Configuration argument. Contributed by Jakob Homan.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@833553 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Devaraj Das 2009-11-06 20:54:40 +00:00
parent af59233ce1
commit ad88440651
5 changed files with 11 additions and 4 deletions

View File

@ -10,6 +10,10 @@ Trunk (unreleased changes)
hadoop-config.sh so that it allows setting java command options for hadoop-config.sh so that it allows setting java command options for
JAVA_PLATFORM. (Koji Noguchi via szetszwo) 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 IMPROVEMENTS
HADOOP-6283. Improve the exception messages thrown by HADOOP-6283. Improve the exception messages thrown by

View File

@ -17,6 +17,8 @@
*/ */
package org.apache.hadoop.http; package org.apache.hadoop.http;
import org.apache.hadoop.conf.Configuration;
/** /**
* Initialize a javax.servlet.Filter. * Initialize a javax.servlet.Filter.
*/ */
@ -24,6 +26,7 @@ public abstract class FilterInitializer {
/** /**
* Initialize a Filter to a FilterContainer. * Initialize a Filter to a FilterContainer.
* @param container The filter container * @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);
} }

View File

@ -127,7 +127,7 @@ public class HttpServer implements FilterContainer {
final FilterInitializer[] initializers = getFilterInitializers(conf); final FilterInitializer[] initializers = getFilterInitializers(conf);
if (initializers != null) { if (initializers != null) {
for(FilterInitializer c : initializers) { for(FilterInitializer c : initializers) {
c.initFilter(this); c.initFilter(this, conf);
} }
} }
addDefaultServlets(); addDefaultServlets();

View File

@ -68,7 +68,7 @@ public class TestGlobalFilter extends junit.framework.TestCase {
static public class Initializer extends FilterInitializer { static public class Initializer extends FilterInitializer {
public Initializer() {} public Initializer() {}
void initFilter(FilterContainer container) { public void initFilter(FilterContainer container, Configuration conf) {
container.addGlobalFilter("recording", RecordingFilter.class.getName(), null); container.addGlobalFilter("recording", RecordingFilter.class.getName(), null);
} }
} }

View File

@ -66,7 +66,7 @@ public class TestServletFilter extends junit.framework.TestCase {
static public class Initializer extends FilterInitializer { static public class Initializer extends FilterInitializer {
public Initializer() {} public Initializer() {}
void initFilter(FilterContainer container) { public void initFilter(FilterContainer container, Configuration conf) {
container.addFilter("simple", SimpleFilter.class.getName(), null); container.addFilter("simple", SimpleFilter.class.getName(), null);
} }
} }