本文整理汇总了Java中org.apache.hadoop.http.FilterContainer.addFilter方法的典型用法代码示例。如果您正苦于以下问题:Java FilterContainer.addFilter方法的具体用法?Java FilterContainer.addFilter怎么用?Java FilterContainer.addFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.http.FilterContainer
的用法示例。
在下文中一共展示了FilterContainer.addFilter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
/**
* Initializes Alfredo AuthenticationFilter.
* <p/>
* Propagates to Alfredo AuthenticationFilter configuration all Hadoop
* configuration properties prefixed with "hadoop.http.authentication."
*
* @param container The filter container
* @param conf Configuration for run-time parameters
*/
@Override
public void initFilter(FilterContainer container, Configuration conf) {
Map<String, String> filterConfig = new HashMap<String, String>();
//setting the cookie path to root '/' so it is used for all resources.
filterConfig.put(AuthenticationFilter.COOKIE_PATH, "/");
for (Map.Entry<String, String> entry : conf) {
String name = entry.getKey();
if (name.startsWith(PREFIX)) {
String value = conf.get(name);
name = name.substring(PREFIX.length());
filterConfig.put(name, value);
}
}
container.addFilter("authentication",
AuthenticationFilter.class.getName(),
filterConfig);
}
示例2: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override
public void initFilter(FilterContainer container, Configuration conf) {
HashMap<String, String> options = new HashMap<String, String>();
String username = getUsernameFromConf(conf);
options.put(HADOOP_HTTP_STATIC_USER, username);
container.addFilter("static_user_filter",
StaticUserFilter.class.getName(),
options);
}
示例3: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override
public void initFilter(FilterContainer container, Configuration conf) {
Map<String, String> filterConfig = createFilterConfig(conf);
container.addFilter("RMAuthenticationFilter",
RMAuthenticationFilter.class.getName(), filterConfig);
}
示例4: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override
public void initFilter(FilterContainer container, Configuration conf)
{
logger.debug("Conf {}", conf);
Map<String, String> params = new HashMap<>();
Collection<String> proxies = new ArrayList<>();
if (ConfigUtils.isRMHAEnabled(conf)) {
// HA is enabled get all
for (String rmId : ConfigUtils.getRMHAIds(conf)) {
proxies.add(getResolvedRMWebAppURLWithoutScheme(conf, rmId));
}
logger.info("HA proxy addresses {}", proxies);
}
if (proxies.isEmpty()) {
proxies.add(getProxyHostAndPort(conf));
logger.info("Proxy addresses {}", proxies);
}
StringBuilder proxyBr = new StringBuilder();
for (String proxy : proxies) {
if (proxyBr.length() != 0) {
proxyBr.append(StramWSFilter.PROXY_DELIMITER);
}
String[] parts = proxy.split(":");
proxyBr.append(parts[0]);
}
params.put(StramWSFilter.PROXY_HOST, proxyBr.toString());
container.addFilter(FILTER_NAME, FILTER_CLASS, params);
}
示例5: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override
public void initFilter(FilterContainer container, Configuration conf) {
Map<String, String> params = new HashMap<String, String>();
String proxy = YarnConfiguration.getProxyHostAndPort(conf);
String[] parts = proxy.split(":");
params.put(AmIpFilter.PROXY_HOST, parts[0]);
params.put(AmIpFilter.PROXY_URI_BASE,
HttpConfig.getSchemePrefix() + proxy +
System.getenv(ApplicationConstants.APPLICATION_WEB_PROXY_BASE_ENV));
container.addFilter(FILTER_NAME, FILTER_CLASS, params);
}
示例6: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
/**
* Initializes hadoop-auth AuthenticationFilter.
* <p/>
* Propagates to hadoop-auth AuthenticationFilter configuration all Hadoop
* configuration properties prefixed with "hadoop.http.authentication."
*
* @param container The filter container
* @param conf Configuration for run-time parameters
*/
@Override
public void initFilter(FilterContainer container, Configuration conf) {
Map<String, String> filterConfig = getFilterConfigMap(conf, PREFIX);
// extend AuthenticationFilter's feature to
// support proxy user operation.
container.addFilter("authentication",
AuthenticationWithProxyUserFilter.class.getName(),
filterConfig);
}
示例7: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override
public void initFilter(FilterContainer container, Configuration conf) {
Map<String, String> params = new HashMap<String, String>();
String proxy = WebAppUtils.getProxyHostAndPort(conf);
String[] parts = proxy.split(":");
params.put(AmIpFilter.PROXY_HOST, parts[0]);
params.put(AmIpFilter.PROXY_URI_BASE,
HttpConfig.getSchemePrefix() + proxy +
System.getenv(ApplicationConstants.APPLICATION_WEB_PROXY_BASE_ENV));
container.addFilter(FILTER_NAME, FILTER_CLASS, params);
}
示例8: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override
public void initFilter(FilterContainer container, Configuration conf) {
container.addFilter("static_user_filter", StaticUserFilter.class.getName(),
new HashMap<String,String>());
}
示例9: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
/**
* Initializes hadoop-auth AuthenticationFilter.
* <p/>
* Propagates to hadoop-auth AuthenticationFilter configuration all Hadoop
* configuration properties prefixed with "hadoop.http.authentication."
*
* @param container The filter container
* @param conf Configuration for run-time parameters
*/
@Override
public void initFilter(FilterContainer container, Configuration conf) {
Map<String, String> filterConfig = getFilterConfigMap(conf, PREFIX);
container.addFilter("authentication",
AuthenticationFilter.class.getName(),
filterConfig);
}