当前位置: 首页>>代码示例>>Java>>正文


Java FilterConfig.getInitParameter方法代码示例

本文整理汇总了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;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:29,代码来源:DelegationTokenAuthenticationFilter.java

示例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;

   }
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:SetCharacterEncodingFilter.java

示例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;
    }
}
 
开发者ID:craware,项目名称:webapp-tyust,代码行数:30,代码来源:GzipFilter.java

示例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);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:21,代码来源:CorsFilter.java

示例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*");
		}
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:21,代码来源:JsonpFilter.java

示例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;
        }
    }
    
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:45,代码来源:HTTPRequestAuthenticationFilter.java

示例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;
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:36,代码来源:CompressionFilter.java

示例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);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:8,代码来源:CrossOriginFilter.java

示例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));
}
 
开发者ID:Xlongshu,项目名称:EasyController,代码行数:31,代码来源:ActionDispatcherFilter.java

示例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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:CrossOriginFilter.java

示例11: init

import javax.servlet.FilterConfig; //导入方法依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
    excludeUrlPattern = filterConfig
            .getInitParameter("exclude-url-pattern");
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:6,代码来源:AuthorizationFilter.java

示例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;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:7,代码来源:CORSFilter.java

示例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);
            }
        }
    }

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:66,代码来源:CompressionFilter.java

示例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");
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:7,代码来源:EncodingFilter.java

示例15: init

import javax.servlet.FilterConfig; //导入方法依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
	if (this.contentTypes == null) {
		this.contentTypes = filterConfig.getInitParameter("contentTypes");
	}
}
 
开发者ID:mevdschee,项目名称:tqdev-metrics,代码行数:7,代码来源:MeasureRequestPathFilter.java


注:本文中的javax.servlet.FilterConfig.getInitParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。