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:testapp.web.OpenSessionInViewInterceptorFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    servletContext = filterConfig.getServletContext();
    setInterceptorBeanName(filterConfig.getInitParameter("interceptorBeanName"));
}

From source file:com.meltmedia.cadmium.servlets.ApiEndpointAccessFilter.java

@Override
public void init(FilterConfig config) throws ServletException {
    if (config.getInitParameter("jersey-prefix") != null) {
        prefix = config.getInitParameter("jersey-prefix");
    }//from   www  .  j a v a 2s.c  o  m
    if (StringUtils.isEmptyOrNull(prefix)) {
        prefix = "/api/";
    }
}

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

public void init(FilterConfig filterConfig) throws ServletException {
    String allowString = filterConfig.getInitParameter("allowURIs");
    if (!StringUtils.isBlank(allowString)) {
        this.allowURIs = Arrays.asList(allowString.split(",\\s*"));
    }//from  w ww. j  a  va  2 s.c  o m
}

From source file:org.roda.wui.filter.InternalApiAuthFilter.java

@Override
public void init(final FilterConfig filterConfig) throws ServletException {
    final String realmParam = filterConfig.getInitParameter("realm");
    if (StringUtils.isNotBlank(realmParam)) {
        realm = realmParam;/*www. ja v a2s  . co  m*/
    }
    final String exclusionsParam = filterConfig.getInitParameter("exclusions");
    if (StringUtils.isNotBlank(exclusionsParam)) {
        final String[] listOfExclusions = exclusionsParam.split(",");
        for (String exclusion : listOfExclusions) {
            exclusions.add(exclusion.trim());
        }
    }
}

From source file:by.creepid.jsf.fileupload.UploadFilter.java

/**
 * Method for retrieving the temporary directory for storing uploaded file
 * By default the system's temporary directory will be used if no
 * reposistory path is configure in the web.xml
 *
 * @param config/*from   ww  w . jav a2 s. c o m*/
 */
private void setRepositoryPath(FilterConfig config) {
    String repositoryInitParam = config
            .getInitParameter("by.creepid.jsf.fileupload.UploadFilter.repositoryPath");

    if (repositoryInitParam == null || "".equals(repositoryInitParam)) {
        repositoryInitParam = System.getProperty("java.io.tmpdir");
    }

    if (!repositoryInitParam.endsWith("/")) {
        repositoryInitParam += "/";
    }

    this.repositoryPath = repositoryInitParam;
}

From source file:org.nuxeo.wss.servlet.WSSFilter.java

@Override
protected void initBackend(FilterConfig filterConfig) {
    String factoryName = filterConfig.getInitParameter(BACKEND_FACTORY_PARAM);
    if (factoryName != null) {
        WSSConfig.instance().setWssBackendFactoryClassName(factoryName);
    }//from   w  w w  .  ja  va  2 s .  co  m
}

From source file:org.yestech.lib.io.FileSystemFileDownloadFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    deleteAfterDownload = toBoolean(/*from   w  w  w .j  ava2  s  . c  om*/
            defaultString(filterConfig.getInitParameter("deleteAfterDownload"), "false"), "true", "false");
    String tempBaseDir = defaultString(filterConfig.getInitParameter("baseDirectory"),
            getProperty("java.io.tmpdir"));
    baseDirectory = new File(tempBaseDir);
}

From source file:fr.putnami.pwt.plugin.ajaxbot.filter.AjaxPageFilter.java

@Override
public void init(FilterConfig config) throws ServletException {
    String paramCacheFolder = config.getInitParameter(FILTER_PARAM_CACHE_FOLDER);
    if (!Strings.isNullOrEmpty(paramCacheFolder)) {
        this.cacheFolder = new File(paramCacheFolder);
        this.cacheFolder.mkdirs();
    }// w  w  w . j a  v  a2  s  .  co m
    String serverUrl = config.getInitParameter(FILTER_PARAM_SERVER_URL);
    if (!Strings.isNullOrEmpty(paramCacheFolder)) {
        this.serverUrl = serverUrl;
    }
}

From source file:de.highbyte_le.weberknecht.security.filters.AuthenticationFilter.java

/**
 * Called when Filter is put into service.
 *//*from w  ww . j a v  a2 s  .  c  o m*/
@Override
public void init(FilterConfig config) {
    String authenticationClass = config.getInitParameter("authentication_class");
    if (authenticationClass == null)
        logger.fatal("init() - authentication_class is not set!");
    else {
        try {
            Object o = Class.forName(authenticationClass).newInstance();
            if (o instanceof UsernamePasswordAuthenticator) {
                authentication = (UsernamePasswordAuthenticator) o;
            } else {
                logger.fatal(
                        "init() - Authenticator class is not an instance of UsernamePasswordAuthenticator");
            }
        } catch (Exception e) {
            logger.fatal("init() - authentication class couldn't be initialized");
        }
    }

    doParameter = config.getInitParameter("do_param");
    if (null == doParameter)
        doParameter = "do";
}

From source file:org.mikha.utils.web.multipart.MultiparFilter.java

public void init(FilterConfig config) throws ServletException {
    File dir;//from   w  ww.j a  va  2s .c  o  m
    String s = config.getInitParameter("uploadDir");
    if (s != null) {
        dir = new File(s);
    } else {
        dir = (File) config.getServletContext().getAttribute("javax.servlet.context.tempdir");
        if (dir == null) {
            throw new ServletException("Cannot determine temporary upload directory. Set an uploadDir "
                    + "init parameter or ensure the javax.servlet.context.tempdir " + "directory is valid");
        }
    }

    int maxSize = Integer.MAX_VALUE;
    s = config.getInitParameter("maxSize");
    if (s != null) {

        try {
            maxSize = Integer.parseInt(s);
            if (maxSize <= 0) {
                throw new IllegalArgumentException("Must be positive");
            }
        } catch (IllegalArgumentException iaex) {
            throw new ServletException("Value \"" + s + "\" is not valid for maxSize parameter", iaex);
        }

    }

    fileItemFactory = new DiskFileItemFactory(maxSize, dir);
}