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:com.google.code.profiling.filters.ProfilingTimerFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    long minTime = NumberUtils.toLong(filterConfig.getInitParameter(MIN_TIME_PARAM), 0);
    this.utilTimerStack = new UtilTimerStack(minTime);
}

From source file:nl.strohalm.cyclos.http.SanitizerFilter.java

@Override
public void init(final FilterConfig config) throws ServletException {
    super.init(config);

    String excluded = config.getInitParameter("exclusionPattern");
    if (StringUtils.isNotEmpty(excluded)) {
        excluded = StringUtils.deleteWhitespace(StringUtils.replace(excluded, "\n", "|"));
        if (StringUtils.isNotEmpty(excluded)) {
            exclusionPattern = Pattern.compile(excluded);
        }/*from  ww  w.j  av a 2s. co m*/
    }
}

From source file:com.netease.channel.security.AuthenticatorFilter.java

@Override
public void init(FilterConfig arg0) throws ServletException {
    String temp = arg0.getInitParameter(LoginUtil.LOGIN_URL);
    if (!StringUtils.isEmpty(temp)) {
        realm = temp;//from w  w w .  java2 s  . co m
    }
    LOG.info("Login user " + realm);

    String home = arg0.getServletContext().getRealPath("WEB-INF");
    LOG.info("Home directory=" + home);
    System.setProperty("native.home", home);

}

From source file:org.sonar.plugins.cas.cas1.Cas1AuthenticationFilterTest.java

private boolean verifyParam(FilterConfig config, String key, String value) {
    String param = config.getInitParameter(key);
    boolean ok = StringUtils.equals(value, param);
    if (!ok) {/*from w  w w.j a va 2 s. com*/
        System.out.println("Parameter " + key + " has bad value: " + param);
    }

    return ok;
}

From source file:com.google.code.profiling.filters.ProfilingMemoryFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    long minMemory = NumberUtils.toLong(filterConfig.getInitParameter(MIN_MEMORY_PARAM), 0);
    this.utilMemoryStack = new UtilMemoryStack(minMemory);
}

From source file:opa.filter.LoadInitiativeSetup.java

@Override
public void init(FilterConfig fc) throws ServletException {
    jdbcJndi = fc.getInitParameter("jdbcJndi");
}

From source file:com.earldouglas.filtre.Filtre.java

public void init(FilterConfig filterConfig) throws ServletException {
    try {/* w w  w  .j  a  v a  2s.com*/
        if (filterConfig.getInitParameter("whiteList") == null
                && filterConfig.getInitParameter("blackList") == null
                && filterConfig.getInitParameter("configLocation") == null) {
            useConfigLocation("classpath:filtre.properties");
        } else {
            addressManager.extendWhiteList(filterConfig.getInitParameter("whiteList"));
            addressManager.extendBlackList(filterConfig.getInitParameter("blackList"));
            useConfigLocation(filterConfig.getInitParameter("configLocation"));
        }
    } catch (AddressFormatException addressFormatException) {
        throw new ServletException(addressFormatException);
    }
}

From source file:com.example.HoneycombFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    libhoney = new LibHoney.Builder().writeKey(filterConfig.getInitParameter("honeycomb.writeKey"))
            .dataSet(filterConfig.getInitParameter("honeycomb.dataSet")).build();
    try {/*from   w  w  w. j  a v  a 2s  .  c  o  m*/
        libhoney.addField("server", InetAddress.getLocalHost().getHostName());
    } catch (UnknownHostException e) {
        log.error(e.getMessage(), e);
    }
}

From source file:alpine.filters.WhitelistUrlFilter.java

/**
 * Initialize "allowUrls" parameter from web.xml.
 *
 * @param filterConfig A filter configuration object used by a servlet container
 *                     to pass information to a filter during initialization.
 *//*from w ww  . j  a  va 2 s . c  o m*/
public void init(final FilterConfig filterConfig) {

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

}

From source file:org.force66.correlate.RequestCorrelationFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    String headerName = filterConfig.getInitParameter(INIT_PARM_CORRELATION_ID_HEADER);
    if (StringUtils.isEmpty(headerName)) {
        correlationHeaderName = DEFAULT_CORRELATION_ID_HEADER_NAME;
    } else {/*from  www  . jav  a 2 s .c  o  m*/
        correlationHeaderName = headerName.trim();
    }

    String mdcName = filterConfig.getInitParameter(INIT_PARM_LOGGER_NDC_NAME);
    if (StringUtils.isEmpty(mdcName)) {
        loggerMdcName = DEFAULT_LOGGER_MDC_NAME;
    } else {
        loggerMdcName = mdcName.trim();
    }
}