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.apache.hadoop.hdfsproxy.AuthorizationFilter.java

/** {@inheritDoc} **/
public void init(FilterConfig filterConfig) throws ServletException {
    contextPath = filterConfig.getServletContext().getContextPath();
    Configuration conf = new Configuration(false);
    conf.addResource("hdfsproxy-default.xml");
    conf.addResource("hdfsproxy-site.xml");
    namenode = conf.get("fs.default.name");
}

From source file:cc.kune.core.server.rack.filters.rest.CORSServiceFilter.java

@Override
public void init(final FilterConfig filterConfig) throws ServletException {
    super.init(filterConfig);
    this.ctx = filterConfig.getServletContext();
    getInjector().injectMembers(this);
}

From source file:com.github.woonsan.katharsis.servlet.AbstractKatharsisFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    servletContext = filterConfig.getServletContext();
    filterBasePath = filterConfig.getInitParameter(INIT_PARAM_FILTER_BASE_PATH);
}

From source file:com.sun.socialsite.web.filters.ThreadContextFilter.java

/**
 * Initializes this filter.//from w ww . j  a v  a 2s .c o m
 */
public void init(FilterConfig filterConfig) throws ServletException {
    ServletContext context = filterConfig.getServletContext();
    Injector injector = (Injector) (context.getAttribute(GuiceServletContextListener.INJECTOR_ATTRIBUTE));
    SecurityTokenDecoder securityTokenDecoder = injector.getInstance(SecurityTokenDecoder.class);
    if (securityTokenDecoder instanceof SocialSiteTokenDecoder) {
        this.decoder = (SocialSiteTokenDecoder) securityTokenDecoder;
    }
}

From source file:de.highbyte_le.weberknecht.ControllerFilter.java

/**
 * filter initialization//from w w w.j  a va  2 s .  c  om
 */
@Override
public void init(FilterConfig filterConfig) throws ServletException {
    try {
        core = new ControllerCore(filterConfig.getServletContext());
    } catch (Exception e) {
        log.error("init() - Exception: " + e.getMessage(), e);
        throw new ServletException("internal error", e);
    }
}

From source file:org.glite.slcs.filter.AttributesAuthorizationFilter.java

public void init(FilterConfig filterConfig) throws ServletException {

    ServletContext context = filterConfig.getServletContext();
    // try to configure log4j
    Log4JConfiguration.configure(context);

    try {//  w  w  w . j  av  a 2s .com
        LOG.info("create and initialize new AccessControlList");
        accessControlList_ = AccessControlListFactory.newInstance(filterConfig);
    } catch (SLCSException e) {
        LOG.error("Failed to instantiate and initalize AccessControlList", e);
        throw new ServletException("Failed to instantiate and initalize AccessControlList: " + e, e);
    }

    // initialize the AttributeDefintions from the servlet context
    try {
        AttributeDefinitionsFactory.initialize(context);
        attributeDefinitions_ = AttributeDefinitionsFactory.getInstance();
    } catch (SLCSException e) {
        LOG.error("Failed to instantiate AttributeDefinitions", e);
        throw new ServletException("Failed to initialize and create the AttributeDefinitions: " + e, e);
    }
}

From source file:org.wso2.carbon.identity.application.authentication.endpoint.AuthenticationEndpointFilter.java

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

From source file:io.lavagna.web.security.HSTSFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    WebApplicationContext ctx = getRequiredWebApplicationContext(filterConfig.getServletContext());
    config = ctx.getBean(ConfigurationRepository.class);

    if ("true".equals(config.getValueOrNull(Key.USE_HTTPS))) {
        filterConfig.getServletContext().getSessionCookieConfig().setSecure(true);
    }// w  ww  . j ava 2  s  .c o  m
}

From source file:jrouter.servlet.filter.SpringBeanJRouterFilter.java

/**
 * ActionFactoryspringbean// www.j  av a  2s.  com
 *
 * @param filterConfig ?
 *
 * @return ActionFactory bean.
 */
@Override
protected ActionFactory createActionFactory(FilterConfig filterConfig) {
    //set ActionFactory with spring bean
    return beanName == null
            ? WebApplicationContextUtils.getRequiredWebApplicationContext(filterConfig.getServletContext())
                    .getBean(ActionFactory.class)
            : WebApplicationContextUtils.getRequiredWebApplicationContext(filterConfig.getServletContext())
                    .getBean(beanName, ActionFactory.class);
}

From source file:io.lavagna.web.security.SecurityFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    WebApplicationContext ctx = getRequiredWebApplicationContext(filterConfig.getServletContext());
    for (Entry<String, SecurityConfiguration> kv : ctx.getBeansOfType(SecurityConfiguration.class).entrySet()) {
        pathsToCheck.put(kv.getKey(), ImmutablePair.of(kv.getValue(), kv.getValue().buildMatcherList()));
    }//from   w w  w.  j av a 2 s.  c om
}