本文整理汇总了Java中javax.servlet.FilterConfig.getInitParameter方法的典型用法代码示例。如果您正苦于以下问题:Java FilterConfig.getInitParameter方法的具体用法?Java FilterConfig.getInitParameter怎么用?Java FilterConfig.getInitParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.servlet.FilterConfig
的用法示例。
在下文中一共展示了FilterConfig.getInitParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProxyuserConfiguration
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
/**
* Returns the proxyuser configuration. All returned properties must start
* with <code>proxyuser.</code>'
* <p/>
* Subclasses may override this method if the proxyuser configuration is
* read from other place than the filter init parameters.
*
* @param filterConfig filter configuration object
* @return the proxyuser configuration properties.
* @throws ServletException thrown if the configuration could not be created.
*/
protected Configuration getProxyuserConfiguration(FilterConfig filterConfig)
throws ServletException {
// this filter class gets the configuration from the filter configs, we are
// creating an empty configuration and injecting the proxyuser settings in
// it. In the initialization of the filter, the returned configuration is
// passed to the ProxyUsers which only looks for 'proxyusers.' properties.
Configuration conf = new Configuration(false);
Enumeration<?> names = filterConfig.getInitParameterNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
if (name.startsWith(PROXYUSER_PREFIX + ".")) {
String value = filterConfig.getInitParameter(name);
conf.set(name, value);
}
}
return conf;
}
示例2: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
/**
* Place this filter into service.
*
* @param filterConfig The filter configuration object
*/
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
this.encoding = filterConfig.getInitParameter("encoding");
String value = filterConfig.getInitParameter("ignore");
if (value == null)
this.ignore = true;
else if (value.equalsIgnoreCase("true"))
this.ignore = true;
else if (value.equalsIgnoreCase("yes"))
this.ignore = true;
else
this.ignore = false;
}
示例3: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
/**
* <B>方法名称:</B>初始化<BR>
* <B>概要说明:</B>初始化过滤器<BR>
*
* @param fConfig 过滤器配置
* @throws ServletException Servlet异常
* @see Filter#init(FilterConfig)
*/
public void init(FilterConfig fConfig) throws ServletException {
String param = fConfig.getInitParameter(PARAM_KEY_HEADERS);
if (param == null || param.trim().length() < 1) {
return;
}
this.headers = new HashMap<String, String>();
String[] params = param.split(",");
String[] kvs = null;
for (int i = 0; i < params.length; i++) {
param = params[i];
if (param != null && param.trim().length() > 0) {
kvs = param.split("=");
if (kvs != null && kvs.length == 2) {
headers.put(kvs[0], kvs[1]);
}
}
}
if (this.headers.isEmpty()) {
this.headers = null;
}
}
示例4: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
@Override
public void init(final FilterConfig filterConfig) throws ServletException {
// Initialize defaults
parseAndStore(DEFAULT_ALLOWED_ORIGINS, DEFAULT_ALLOWED_HTTP_METHODS, DEFAULT_ALLOWED_HTTP_HEADERS,
DEFAULT_EXPOSED_HEADERS, DEFAULT_SUPPORTS_CREDENTIALS, DEFAULT_PREFLIGHT_MAXAGE,
DEFAULT_DECORATE_REQUEST);
if (filterConfig != null) {
String configAllowedOrigins = filterConfig.getInitParameter(PARAM_CORS_ALLOWED_ORIGINS);
String configAllowedHttpMethods = filterConfig.getInitParameter(PARAM_CORS_ALLOWED_METHODS);
String configAllowedHttpHeaders = filterConfig.getInitParameter(PARAM_CORS_ALLOWED_HEADERS);
String configExposedHeaders = filterConfig.getInitParameter(PARAM_CORS_EXPOSED_HEADERS);
String configSupportsCredentials = filterConfig.getInitParameter(PARAM_CORS_SUPPORT_CREDENTIALS);
String configPreflightMaxAge = filterConfig.getInitParameter(PARAM_CORS_PREFLIGHT_MAXAGE);
String configDecorateRequest = filterConfig.getInitParameter(PARAM_CORS_REQUEST_DECORATE);
parseAndStore(configAllowedOrigins, configAllowedHttpMethods, configAllowedHttpHeaders,
configExposedHeaders, configSupportsCredentials, configPreflightMaxAge, configDecorateRequest);
}
}
示例5: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
public void init(FilterConfig config)
{
String tempJsonp = config.getInitParameter("jsonp");
String tempJsonMimeTypes = config.getInitParameter("json-mime-types");
if( tempJsonp != null && !tempJsonp.equals("") )
{
this.jsonp = tempJsonp;
}
if( tempJsonMimeTypes != null )
{
if( tempJsonMimeTypes.equals("") )
{
this.jsonMimeTypes = new String[]{};
}
else
{
this.jsonMimeTypes = tempJsonMimeTypes.trim().split("\\s*,\\s*");
}
}
}
示例6: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
/**
* Initialize the filter
*
* @param config
* FitlerConfig
* @exception ServletException
*/
public void init(FilterConfig config) throws ServletException
{
// Save the context
m_context = config.getServletContext();
// Setup the authentication context
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(m_context);
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
setNodeService(serviceRegistry.getNodeService());
setAuthenticationService(serviceRegistry.getAuthenticationService());
setTransactionService(serviceRegistry.getTransactionService());
setPersonService((PersonService) ctx.getBean("PersonService")); // transactional and permission-checked
m_authComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
httpServletRequestAuthHeaderName = config.getInitParameter("httpServletRequestAuthHeaderName");
if(httpServletRequestAuthHeaderName == null)
{
httpServletRequestAuthHeaderName = "x-user";
}
this.m_authPatternString = config.getInitParameter("authPatternString");
if (this.m_authPatternString != null)
{
try
{
m_authPattern = Pattern.compile(this.m_authPatternString);
}
catch (PatternSyntaxException e)
{
logger.warn("Invalid pattern: " + this.m_authPatternString, e);
m_authPattern = null;
}
}
}
示例7: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
/**
* Place this filter into service.
*
* @param filterConfig The filter configuration object
*/
public void init(FilterConfig filterConfig) {
config = filterConfig;
if (filterConfig != null) {
String value = filterConfig.getInitParameter("debug");
if (value!=null) {
debug = Integer.parseInt(value);
} else {
debug = 0;
}
String str = filterConfig.getInitParameter("compressionThreshold");
if (str!=null) {
compressionThreshold = Integer.parseInt(str);
if (compressionThreshold != 0 && compressionThreshold < minThreshold) {
if (debug > 0) {
System.out.println("compressionThreshold should be either 0 - no compression or >= " + minThreshold);
System.out.println("compressionThreshold set to " + minThreshold);
}
compressionThreshold = minThreshold;
}
} else {
compressionThreshold = 0;
}
} else {
compressionThreshold = 0;
}
}
示例8: initializeMaxAge
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
private void initializeMaxAge(FilterConfig filterConfig) {
maxAge = filterConfig.getInitParameter(MAX_AGE);
if (maxAge == null) {
maxAge = MAX_AGE_DEFAULT;
}
LOG.info("Max Age: " + maxAge);
}
示例9: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
logger.debug("init...");
long start = System.currentTimeMillis();
// 获取配置类
String configClass = filterConfig.getInitParameter("configClass");
createDispatcherConfig(configClass);
ServletContext servletContext = filterConfig.getServletContext();
String realPath = servletContext.getRealPath("/");
logger.info("webRootPath:{}", realPath);
Constants.me().setWebRootPath(new File(realPath));
config();
BeanFactory.getInject().injectMembers(ViewManager.me());
ViewManager.me().init(servletContext);
String contextPath = servletContext.getContextPath();
logger.info("contextPath:{}", contextPath);
contextPathLength = (contextPath == null || "/".equals(contextPath) ? 0 : contextPath.length());
actionHandler = BeanFactory.getBean(ActionHandler.class);
actionHandler.init(contextPath);
actionConfig.afterStart();
long end = System.currentTimeMillis();
logger.info("init {} ms", (end - start));
}
示例10: initializeAllowedOrigins
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
private void initializeAllowedOrigins(FilterConfig filterConfig) {
String allowedOriginsConfig =
filterConfig.getInitParameter(ALLOWED_ORIGINS);
if (allowedOriginsConfig == null) {
allowedOriginsConfig = ALLOWED_ORIGINS_DEFAULT;
}
allowedOrigins.addAll(
Arrays.asList(allowedOriginsConfig.trim().split("\\s*,\\s*")));
allowAllOrigins = allowedOrigins.contains("*");
LOG.info("Allowed Origins: " + StringUtils.join(allowedOrigins, ','));
LOG.info("Allow All Origins: " + allowAllOrigins);
}
示例11: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
excludeUrlPattern = filterConfig
.getInitParameter("exclude-url-pattern");
}
示例12: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// TODO Auto-generated method stub
String isCrossStr = filterConfig.getInitParameter("IsCross");
isCross = isCrossStr.equals("true")?true:false;
}
示例13: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
/**
* Place this filter into service.
*
* @param filterConfig The filter configuration object
*/
@Override
public void init(FilterConfig filterConfig) {
config = filterConfig;
if (filterConfig != null) {
String value = filterConfig.getInitParameter("debug");
if (value!=null) {
debug = Integer.parseInt(value);
}
String str = filterConfig.getInitParameter("compressionThreshold");
if (str!=null) {
compressionThreshold = Integer.parseInt(str);
if (compressionThreshold != 0 && compressionThreshold < minThreshold) {
if (debug > 0) {
System.out.println("compressionThreshold should be either 0 - no compression or >= " + minThreshold);
System.out.println("compressionThreshold set to " + minThreshold);
}
compressionThreshold = minThreshold;
}
}
str = filterConfig.getInitParameter("compressionBuffer");
if (str!=null) {
compressionBuffer = Integer.parseInt(str);
if (compressionBuffer < minBuffer) {
if (debug > 0) {
System.out.println("compressionBuffer should be >= " + minBuffer);
System.out.println("compressionBuffer set to " + minBuffer);
}
compressionBuffer = minBuffer;
}
}
str = filterConfig.getInitParameter("compressionMimeTypes");
if (str!=null) {
List<String> values = new ArrayList<String>();
StringTokenizer st = new StringTokenizer(str, ",");
while (st.hasMoreTokens()) {
String token = st.nextToken().trim();
if (token.length() > 0) {
values.add(token);
}
}
if (values.size() > 0) {
compressionMimeTypes = values.toArray(
new String[values.size()]);
} else {
compressionMimeTypes = null;
}
if (debug > 0) {
System.out.println("compressionMimeTypes set to " + compressionMimeTypes);
}
}
}
}
示例14: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
/**
* @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
*/
public void init(FilterConfig fc) throws ServletException {
iEncoding = fc.getInitParameter("encoding");
}
示例15: init
import javax.servlet.FilterConfig; //导入方法依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
if (this.contentTypes == null) {
this.contentTypes = filterConfig.getInitParameter("contentTypes");
}
}