public WebAppConfigurationBuilder addFilter(
Class<? extends Filter> filterClass,
String pattern,
Properties initParams) {
MutableWebAppFilter filter = MutableWebAppFilter.create();
filter.setFilterName(filterClass.getName());
filter.setFilterClass(filterClass.getName());
MutableWebAppInitParam initParam;
for (Object okey : initParams.keySet()) {
String key = okey.toString();
String value = initParams.getProperty(key);
initParam = MutableWebAppInitParam.create();
initParam.setParamName(key);
initParam.setParamValue(value);
filter.addInitParam(initParam);
}
config.addFilter(filter);
MutableWebappFilterMapping filterMapping
= MutableWebappFilterMapping.create();
filterMapping.setFilterName(filterClass.getName());