Example usage for javax.servlet FilterConfig getServletContext

List of usage examples for javax.servlet FilterConfig getServletContext

Introduction

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

Prototype

public ServletContext getServletContext();

Source Link

Document

Returns a reference to the ServletContext in which the caller is executing.

Usage

From source file:org.osaf.cosmo.filters.UsernameRequestIntegrationFilter.java

public void init(FilterConfig config) throws ServletException {
    WebApplicationContext wac = WebApplicationContextUtils
            .getRequiredWebApplicationContext(config.getServletContext());

    this.securityManager = (CosmoSecurityManager) wac.getBean(BEAN_SECURITY_MANAGER,
            CosmoSecurityManager.class);

    if (this.securityManager == null) {
        throw new ServletException(
                "Could not initialize HttpLoggingFilter: " + "Could not find security manager.");
    }//from   w w w  .  j  av  a  2s.c  o  m
}

From source file:com.sourcesense.alfresco.opensso.AlfrescoOpenSSOFilter.java

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

}

From source file:edu.cornell.mannlib.vitro.webapp.filters.WebappDaoFactorySDBPrep.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    try {/*from w ww.  j  a  v a 2 s  .  c  o m*/
        _ctx = filterConfig.getServletContext();
    } catch (Throwable t) {
        log.error("Unable to initialize WebappDaoFactorySDBPrep", t);
    }
}

From source file:com.opensymphony.able.filter.SimpleTransactionServletFilter.java

public void init(FilterConfig config) throws ServletException {
    context = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext());
}

From source file:inet.common.jsf.request.FileUploadFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    boolean isAtLeastJSF22 = detectJSF22();
    String uploader = filterConfig.getServletContext().getInitParameter("primefaces.UPLOADER");
    if (uploader == null || uploader.equals("auto")) {
        bypass = isAtLeastJSF22;// w  w  w.j a v  a  2s  .c  o  m
    } else if (uploader.equals("native")) {
        bypass = true;
    } else if (uploader.equals("commons")) {
        bypass = false;
    }

    thresholdSize = filterConfig.getInitParameter(THRESHOLD_SIZE_PARAM);
    uploadDir = filterConfig.getInitParameter(UPLOAD_DIRECTORY_PARAM);
}

From source file:info.magnolia.cms.filters.InstallFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    super.init(filterConfig);
    servletContext = filterConfig.getServletContext();
}

From source file:org.wso2.carbon.apimgt.application.extension.api.filter.ApiPermissionFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    InputStream permissionStream = filterConfig.getServletContext().getResourceAsStream(PERMISSION_CONFIG_PATH);
    if (permissionStream != null) {
        try {/*  ww w  .  j  av a2 s.com*/
            JAXBContext cdmContext = JAXBContext.newInstance(PermissionConfiguration.class);
            Unmarshaller unmarshaller = cdmContext.createUnmarshaller();
            PermissionConfiguration permissionConfiguration = (PermissionConfiguration) unmarshaller
                    .unmarshal(permissionStream);
            permissions = permissionConfiguration.getPermissions();
            for (Permission permission : permissions) {
                APIUtil.putPermission(PERMISSION_PREFIX + permission.getPath());
            }
        } catch (JAXBException e) {
            log.error("invalid permissions.xml", e);
        }

    }

}

From source file:fr.openwide.talendalfresco.rest.server.CommandAuthenticationFilter.java

/**
 * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
 *///  www .ja v a 2  s. c  o  m
public void init(FilterConfig config) throws ServletException {
    this.context = config.getServletContext();
}

From source file:org.soulwing.cas.filter.FilterToBeanProxy.java

public void init(FilterConfig filterConfig) throws ServletException {
    target = getTargetBean(/*  ww  w.  j a va 2 s.  c  om*/
            WebApplicationContextUtils.getRequiredWebApplicationContext(filterConfig.getServletContext()),
            getTargetBeanName(filterConfig));
}

From source file:iddb.web.security.service.UserServiceFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    this.context = filterConfig.getServletContext();
    Map<String, String> local = SecurityConfig.getInstance().getSection("urls");
    if (local == null) {
        urls = Collections.emptyMap();
    } else {/* ww w  .  j  a  v a 2 s . c  o  m*/
        urls = new LinkedHashMap<String, Set<String>>();
        for (Entry<String, String> entry : local.entrySet()) {
            Set<String> s = new LinkedHashSet<String>(Arrays.asList(entry.getValue().split(",")));
            urls.put(entry.getKey(), s);
        }
    }
}