Example usage for javax.servlet FilterConfig getInitParameter

List of usage examples for javax.servlet FilterConfig getInitParameter

Introduction

In this page you can find the example usage for javax.servlet FilterConfig getInitParameter.

Prototype

public String getInitParameter(String name);

Source Link

Document

Returns a String containing the value of the named initialization parameter, or null if the initialization parameter does not exist.

Usage

From source file:org.codelabor.system.security.web.filter.SelectiveSessionValidationFilter.java

public List<String> getIncludePatterns(FilterConfig filterConfig) {
    String tempIncludePattern = filterConfig.getInitParameter("includes");
    List<String> includePatterns = null;
    if (!StringUtils.isBlank(tempIncludePattern)) {
        String[] includePatternsString = tempIncludePattern.split(delimeterPattern);
        if (includePatternsString != null && includePatternsString.length > 0) {
            includePatterns = Arrays.asList(includePatternsString);
        }/*ww w  . j  ava  2  s  .  c om*/
    }
    logger.debug("includePatterns: {}", includePatterns);
    return includePatterns;
}

From source file:alpine.filters.BlacklistUrlFilter.java

/**
 * Initialize "deny" parameter from web.xml.
 *
 * @param filterConfig A filter configuration object used by a servlet container
 *                     to pass information to a filter during initialization.
 */// w w w  .  j a  va2 s.  com
public void init(final FilterConfig filterConfig) {

    final String denyParam = filterConfig.getInitParameter("denyUrls");
    if (StringUtils.isNotBlank(denyParam)) {
        this.denyUrls = denyParam.split(",");
    }

    final String ignoreParam = filterConfig.getInitParameter("ignoreUrls");
    if (StringUtils.isNotBlank(ignoreParam)) {
        this.ignoreUrls = ignoreParam.split(",");
    }

}

From source file:com.thruzero.common.web.filter.InitFilter.java

@Override
@ConfigBookmark(comment = "initialize config")
public void init(FilterConfig config) throws ServletException {
    String configFilePath = config
            .getInitParameter(InitFilterInitParameterWebXmlKeys.CONFIG_FILE_PATH_INIT_PARAM); // get config file path from web.xml init-param
    String configFileEnvironmentVar = config
            .getInitParameter(InitFilterInitParameterWebXmlKeys.CONFIG_FILE_PATH_ENV_VAR_NAME_INIT_PARAM); // get config file environment var name from web.xml init-param

    if (StringUtils.isNotEmpty(configFileEnvironmentVar)) {
        String configDirPath = System.getenv(configFileEnvironmentVar);

        // if env var set for config home, then attempt to substitute
        if (StringUtils.isEmpty(configDirPath)) {
            logger.error("*** ERROR *** ENVIRONMENT VAR NAME '" + configFileEnvironmentVar
                    + "' WAS PROVIDED, but no value was found.");
        } else {// w  w  w  .  ja  va 2 s  .co m
            configFilePath = StringUtils.replace(configFilePath, "${" + configFileEnvironmentVar + "}",
                    configDirPath);
        }
    }

    // init config
    ConfigLocator.setup(configFilePath, null); // TODO-p1(george) add config implementation name as an option to web.xml
}

From source file:jp.co.opentone.bsol.framework.web.filter.FeedAuthenticationFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    String name = filterConfig.getInitParameter(AUTHENTICATOR_FACTORY);
    if (StringUtils.isEmpty(name)) {
        log.error("Authenticator factory not specified.");
        throw new ServletException("Authenticator factory not specified.");
    }//  w  w  w .  ja  va 2s.  com
    setupAuthenticator(name, filterConfig);
}

From source file:com.doculibre.constellio.filters.LocalRequestFilter.java

@Override
public void init(FilterConfig config) throws ServletException {
    String ignoredPrefixesStr = config.getInitParameter("ignoredPrefixes");
    if (StringUtils.isBlank(ignoredPrefixesStr)) {
        ignoredPrefixes = new String[] { "/app", "/computeSearchResultClick" };
    } else {/*w w  w .  j a  va2 s . c o m*/
        ignoredPrefixes = StringUtils.split(ignoredPrefixesStr, ",");
    }
}

From source file:gov.nih.nci.cabig.caaers.web.filters.XSSFilter.java

public void init(FilterConfig filterConfig) throws ServletException {

    // Parse the Filter's init parameters.
    String allowString = filterConfig.getInitParameter("allowURIs");
    if (!StringUtils.isBlank(allowString)) {
        this.allowURIs = Arrays.asList(allowString.split(",\\s*"));
    }/*from   w ww.java  2 s . c  om*/
}

From source file:com.zeperdi.demo.webapp.DemoFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    this.filterConfig = filterConfig;
    String encoding = filterConfig.getInitParameter("encoding");
    if (StringUtils.isNotBlank(encoding)) {
        this.encoding = encoding;
    }//from w  w  w.  j av a2s  . c  o m

}

From source file:org.yes.cart.web.filter.ShopRequireLoginFilter.java

@Override
public void init(final FilterConfig filterConfig) throws ServletException {
    super.init(filterConfig);
    if (StringUtils.isNotBlank(filterConfig.getInitParameter("loginOrRegistrationUri"))) {
        this.loginOrRegistrationUri = filterConfig.getInitParameter("loginOrRegistrationUri");
    } else {/*from w ww  .  j  a  va 2  s.  com*/
        this.loginOrRegistrationUri = "/login";
    }
}

From source file:mitm.djigzo.web.utils.IPFilter.java

private void initExcludePattern(FilterConfig filterConfig) {
    String regExp = filterConfig.getInitParameter("exclude-servlet-path");

    if (StringUtils.isNotBlank(regExp)) {
        excludePattern = Pattern.compile(regExp);
    }/*from  w  w  w . j a va 2 s .c o m*/
}

From source file:org.uberfire.ext.security.server.BasicAuthSecurityFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    final String realmName = filterConfig.getInitParameter(REALM_NAME_PARAM);
    if (realmName != null) {
        this.realmName = realmName;
    }/*www  .  j  ava2  s. c o m*/
}