本文整理汇总了Java中org.apache.hadoop.http.FilterContainer.addGlobalFilter方法的典型用法代码示例。如果您正苦于以下问题:Java FilterContainer.addGlobalFilter方法的具体用法?Java FilterContainer.addGlobalFilter怎么用?Java FilterContainer.addGlobalFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.http.FilterContainer
的用法示例。
在下文中一共展示了FilterContainer.addGlobalFilter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override
public void initFilter(FilterContainer container, Configuration conf) {
String key = getEnabledConfigKey();
boolean enabled = conf.getBoolean(key, false);
if (enabled) {
container.addGlobalFilter("Cross Origin Filter",
CrossOriginFilter.class.getName(),
getFilterParameters(conf, getPrefix()));
} else {
LOG.info("CORS filter not enabled. Please set " + key
+ " to 'true' to enable it");
}
}
示例2: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override
public void initFilter(FilterContainer container, Configuration conf) {
// setup the filter
// use the keys with "yarn.timeline-service.http-cross-origin" prefix to
// override the ones with the "hadoop.http.cross-origin" prefix.
Map<String, String> filterParameters =
getFilterParameters(conf, HttpCrossOriginFilterInitializer.PREFIX);
filterParameters.putAll(getFilterParameters(conf, getPrefix()));
container.addGlobalFilter("Cross Origin Filter",
CrossOriginFilter.class.getName(), filterParameters);
}
示例3: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override
public void initFilter(FilterContainer container, Configuration conf) {
container.addGlobalFilter("Cross Origin Filter",
CrossOriginFilter.class.getName(), getFilterParameters(conf));
}
示例4: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override // FilterInitializer
public void initFilter(FilterContainer container, Configuration conf) {
String filterName = S3HdfsFilter.class.getSimpleName();
String filterClass = S3HdfsFilter.class.getName();
String nameNodePort = conf.get(DFS_NAMENODE_HTTP_PORT_KEY,
String.valueOf(DFS_NAMENODE_HTTP_PORT_DEFAULT));
String serviceHostName = conf.get(S3_SERVICE_HOSTNAME_KEY);
String s3Directory = conf.get(S3_DIRECTORY_KEY, S3_DIRECTORY_DEFAULT);
String s3ProxyPort = conf.get(S3_PROXY_PORT_KEY, S3_PROXY_PORT_DEFAULT);
String maxConnections = conf.get(S3_MAX_CONNECTIONS_KEY,
S3_MAX_CONNECTIONS_DEFAULT);
S3HdfsConfiguration s3Conf = new S3HdfsConfiguration();
HashMap<String, String> parameters = new HashMap<String, String>();
/**
* We try to load configuration properties from the Conf passed to us
* first. If they are not set there (hdfs-site + core-site), then we check
* s3hdfs-site + s3hdfs-default configuration files.
*/
if (nameNodePort != null && nameNodePort.length() > 0) {
parameters.put(DFS_NAMENODE_HTTP_PORT_KEY, nameNodePort);
}
if (serviceHostName != null && serviceHostName.length() > 0) {
parameters.put(S3_SERVICE_HOSTNAME_KEY, serviceHostName);
} else {
serviceHostName = s3Conf.get(S3_SERVICE_HOSTNAME_KEY);
if (serviceHostName != null && serviceHostName.length() > 0) {
parameters.put(S3_SERVICE_HOSTNAME_KEY, serviceHostName);
}
}
if (s3Directory != null && s3Directory.length() > 0) {
parameters.put(S3_DIRECTORY_KEY, s3Directory);
} else {
s3Directory = s3Conf.get(S3_DIRECTORY_KEY);
if (s3Directory != null && s3Directory.length() > 0) {
parameters.put(S3_DIRECTORY_KEY, s3Directory);
}
}
if (s3ProxyPort != null && s3ProxyPort.length() > 0) {
parameters.put(S3_PROXY_PORT_KEY, s3ProxyPort);
} else {
s3ProxyPort = s3Conf.get(S3_PROXY_PORT_KEY, S3_PROXY_PORT_DEFAULT);
if (s3ProxyPort != null && s3ProxyPort.length() > 0) {
parameters.put(S3_PROXY_PORT_KEY, s3ProxyPort);
}
}
if (maxConnections != null && maxConnections.length() > 0) {
parameters.put(S3_MAX_CONNECTIONS_KEY, maxConnections);
} else {
maxConnections = s3Conf.get(S3_MAX_CONNECTIONS_KEY,
S3_MAX_CONNECTIONS_DEFAULT);
if (maxConnections != null && maxConnections.length() > 0) {
parameters.put(S3_MAX_CONNECTIONS_KEY, maxConnections);
}
}
container.addGlobalFilter(filterName, filterClass, parameters);
}
示例5: initFilter
import org.apache.hadoop.http.FilterContainer; //导入方法依赖的package包/类
@Override // FilterInitializer
public void initFilter(FilterContainer container, Configuration conf) {
String filterName = AclFilter.class.getName();
container.addGlobalFilter(filterName, filterName, null);
}