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.swdouglass.joid.consumer.OpenIdFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    log.info("init OpenIdFilter");
    String saveInCookie = filterConfig.getInitParameter("saveInCookie");
    if (saveInCookie != null) {
        saveIdentityUrlAsCookie = Boolean.parseBoolean(saveInCookie);
        log.debug("saving identities in cookie: " + saveIdentityUrlAsCookie);
    }/*  w  w w .j av a  2  s .  c  o m*/
    cookieDomain = filterConfig.getInitParameter("cookieDomain");
    String cookieMaxAgeString = filterConfig.getInitParameter("cookieMaxAge");
    if (cookieMaxAgeString != null) {
        cookieMaxAge = Integer.valueOf(cookieMaxAgeString);
    }
    String _ignorePaths = filterConfig.getInitParameter("ignorePaths");
    if (_ignorePaths != null) {
        String paths[] = _ignorePaths.split(",");
        for (int i = 0; i < paths.length; i++) {
            String path = paths[i].trim();
            this.ignorePaths.add(path);
        }
    }
    configuredProperly = true;
    log.debug("end init OpenIdFilter");
}

From source file:uk.ac.lancs.e_science.fileUpload.UploadFilter.java

public void init(FilterConfig config) throws ServletException {
    try {/*  www .  j  av  a 2  s .  c  o m*/
        String paramValue = config.getInitParameter("uk.ac.lancs.e_science.fileUpload.UploadFilter.sizeMax");
        if (paramValue != null)
            sizeMax = Long.parseLong(paramValue) * 1024 * 1024;
    } catch (NumberFormatException ex) {
        ServletException servletEx = new ServletException();
        servletEx.initCause(ex);
        throw servletEx;
    }
}

From source file:com.zoe.weiya.security.WwwAuthFilter.java

@Override
public void init(final FilterConfig filterConfig) throws ServletException {
    String configFilePath = Thread.currentThread().getContextClassLoader().getResource("").getPath()
            + System.getProperty("file.separator") + filterConfig.getInitParameter("auth-config");
    Properties props = new Properties();
    try {//  w w  w . jav a 2 s  . co m
        props.load(new FileInputStream(configFilePath));
    } catch (final IOException ex) {
        log.error("Cannot found auth config file, use default auth config.");
    }
    username = props.getProperty("username", username);
    password = props.getProperty("password", password);
}

From source file:org.codelibs.fess.filter.EncodingFilter.java

@Override
public void init(final FilterConfig config) throws ServletException {
    servletContext = config.getServletContext();

    encoding = config.getInitParameter(LastaPrepareFilter.ENCODING_KEY);
    if (encoding == null) {
        encoding = LastaPrepareFilter.DEFAULT_ENCODING;
    }//from  ww w. j  a  va2s  .c om

    // ex. sjis:Shift_JIS,eucjp:EUC-JP
    final String value = config.getInitParameter(ENCODING_MAP);
    if (StringUtil.isNotBlank(value)) {
        final String[] encodingPairs = value.split(",");
        for (final String pair : encodingPairs) {
            final String[] encInfos = pair.trim().split(":");
            if (encInfos.length == 2) {
                encodingMap.put("/" + encInfos[0] + "/", encInfos[1]);
            }
        }
    }
}

From source file:com.logiclander.jaasmine.authentication.http.SPNegoFilter.java

/**
 * {@inheritDoc}/*from  w ww .jav  a2s  .  c o m*/
 *
 * Checks the given FilterConfig for the init-param named appName.  If this
 * value is not in the FilterConfig, then the default value is used.
 */
@Override
public void init(FilterConfig filterConfig) throws ServletException {

    appName = filterConfig.getInitParameter("appName");
    if (appName == null || appName.isEmpty()) {
        appName = AuthenticationService.DEFAULT_JAASMINE_LOGIN_CONFIG;
    }

    filterName = filterConfig.getFilterName();

    if (logger.isDebugEnabled()) {
        logger.debug(String.format("%s initialized", toString()));
    }
}

From source file:org.sakaiproject.kernel.webapp.filter.SakaiRequestFilter.java

/**
 * {@inheritDoc}//from   www.  ja  va2s.  com
 *
 * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
 */
public void init(FilterConfig config) throws ServletException {
    timeOn = "true".equals(config.getInitParameter(TIME_REQUEST));
    KernelManager kernelManager = new KernelManager();
    sessionManagerService = kernelManager.getService(SessionManagerService.class);
    cacheManagerService = kernelManager.getService(CacheManagerService.class);
    userResolverService = kernelManager.getService(UserResolverService.class);
    transactionManager = kernelManager.getService(TransactionManager.class);
    jcrService = kernelManager.getService(JCRService.class);
    LOG.info("Initializing SessionManagerService " + sessionManagerService);
    LOG.info("Initializing Cache Manager Service " + cacheManagerService);
    noSession = "true".equals(config.getInitParameter(NO_SESSION));
}

From source file:org.wings.recorder.Recorder.java

public void init(FilterConfig filterConfig) throws ServletException {
    if (filterConfig.getInitParameter("wings.servlet.recorder.script") != null)
        scriptName = filterConfig.getInitParameter("wings.servlet.recorder.script");

    lookupName = filterConfig.getInitParameter("wings.servlet.lookupname");

    if (lookupName == null || lookupName.trim().length() == 0) {
        lookupName = "SessionServlet:" + filterConfig.getInitParameter("wings.mainclass");
    }/*from   w  ww . ja v a  2  s.  c om*/

    log.info("wings.servlet.lookupname " + lookupName);
    log.info("wings.servlet.recorder.script " + scriptName);
}

From source file:cc.aileron.wsgi.WsgiHttpFilter.java

@Override
public void init(final FilterConfig config) throws ServletException {
    context = config.getServletContext();
    try {//from   w  w  w .  j av a  2  s.  c  o  m
        appendResourceLoader(context.getRealPath("/"));
        model = new WsgiModel(config.getInitParameter("environment"));
    } catch (final Exception e) {
        logger.error("init-error", e);
        throw new ServletException(e);
    }
}

From source file:com.dangdang.ddframe.job.console.security.WwwAuthFilter.java

@Override
public void init(final FilterConfig filterConfig) throws ServletException {
    String configFilePath = Thread.currentThread().getContextClassLoader().getResource("").getPath()
            + System.getProperty("file.separator") + filterConfig.getInitParameter("auth-config");
    Properties props = new Properties();
    try {//from   w  ww.  j av  a 2  s  . c  o m
        props.load(new FileInputStream(configFilePath));
    } catch (final IOException ex) {
        log.warn("Cannot found auth config file, use default auth config.");
    }
    username = props.getProperty("console.username", username);
    password = props.getProperty("console.password", password);
}

From source file:com.versatus.jwebshield.filter.SecurityTokenFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {

    String file = filterConfig.getInitParameter("configFile");
    if (file != null) {
        UrlExclusionList urlExList = new UrlExclusionList();
        filterConfig.getServletContext().setAttribute(SecurityConstant.CSRF_CHECK_URL_EXCL_LIST_ATTR_NAME,
                urlExList);/*from   w  ww  .  ja  va 2  s.  c  o m*/

        try {
            XMLConfiguration config = new XMLConfiguration(file);
            List<Object> exclusionList = config.getList("urlExclusions");
            tokenTimeout = config.getInteger("tokenTimeout", 1800);
            checkReferer = config.getBoolean("checkReferer", true);
            csrfCookieName = config.getString(SecurityConstant.CSRFCOOKIENAME_PARAM);

            if (exclusionList != null) {
                for (Object obj : exclusionList) {
                    urlExList.addUrl((String) obj);
                }
            }
            logger.info("init: exclusionList=" + exclusionList);
            logger.info("init: urlExList=" + urlExList);
            logger.info("init: csrfCookieName=" + csrfCookieName);
        } catch (Exception cex) {
            logger.error("init: unable to load configFile " + file, cex);

        }
    } else {
        logger.error("init: No configFile specified");
    }

}