當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。