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.commonfarm.web.ECSideFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    this.filterConfig = filterConfig;
    servletContext = filterConfig.getServletContext();
    servletRealPath = servletContext.getRealPath("/");

    initEncoding();//from  ww  w .  j  a  va  2s .  co m
    initEasyList();

    String responseHeadersSetBeforeDoFilter = filterConfig.getInitParameter("responseHeadersSetBeforeDoFilter");
    if (StringUtils.isNotBlank(responseHeadersSetBeforeDoFilter)) {
        ECSideFilter.responseHeadersSetBeforeDoFilter = Boolean.valueOf(responseHeadersSetBeforeDoFilter)
                .booleanValue();
    }

}

From source file:org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    super.init(filterConfig);
    AuthenticationHandler handler = getAuthenticationHandler();
    AbstractDelegationTokenSecretManager dtSecretManager = (AbstractDelegationTokenSecretManager) filterConfig
            .getServletContext().getAttribute(DELEGATION_TOKEN_SECRET_MANAGER_ATTR);
    if (dtSecretManager != null && handler instanceof DelegationTokenAuthenticationHandler) {
        DelegationTokenAuthenticationHandler dtHandler = (DelegationTokenAuthenticationHandler) getAuthenticationHandler();
        dtHandler.setExternalDelegationTokenSecretManager(dtSecretManager);
    }// w  w  w . ja va 2  s .c  o  m
    if (handler instanceof PseudoAuthenticationHandler
            || handler instanceof PseudoDelegationTokenAuthenticationHandler) {
        setHandlerAuthMethod(SaslRpcServer.AuthMethod.SIMPLE);
    }
    if (handler instanceof KerberosAuthenticationHandler
            || handler instanceof KerberosDelegationTokenAuthenticationHandler) {
        setHandlerAuthMethod(SaslRpcServer.AuthMethod.KERBEROS);
    }

    // proxyuser configuration
    Configuration conf = getProxyuserConfiguration(filterConfig);
    ProxyUsers.refreshSuperUserGroupsConfiguration(conf, PROXYUSER_PREFIX);
}

From source file:com.dcs.controller.filter.SecurityServlet.java

@Override
public void init(FilterConfig config) throws ServletException {
    {/*from  w w w.  jav  a 2s. co  m*/
        String exclusions = config.getInitParameter(PARAM_NAME_EXCLUSIONS);
        if (exclusions != null && exclusions.trim().length() != 0) {
            excludesPattern = new HashSet<String>(Arrays.asList(exclusions.split("\\s*,\\s*")));
        }
    }

    {

        this.contextPath = getContextPath(config.getServletContext());
    }
}

From source file:org.seasar.teeda.extension.filter.MultipartFormDataFilter.java

public void init(final FilterConfig filterConfig) throws ServletException {
    maxSize = getSizeParameter(filterConfig, "uploadMaxSize", DEFAULT_MAX_SIZE);
    maxFileSize = getSizeParameter(filterConfig, "uploadMaxFileSize", DEFAULT_MAX_FILE_SIZE);
    thresholdSize = getSizeParameter(filterConfig, "uploadThresholdSize", DEFAULT_THREASHOLD_SIZe);
    repositoryPath = filterConfig.getInitParameter("uploadRepositoryPath");
    servletContext = filterConfig.getServletContext();
}

From source file:com.ultrapower.eoms.common.plugin.ecside.filter.ECSideFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
  this.filterConfig = filterConfig;
   servletContext=filterConfig.getServletContext();
   servletRealPath=servletContext.getRealPath("/");

   initEncoding();//from   w  w  w.ja v  a  2 s . c  om
   initEasyList();
   initProperties();

        
   String responseHeadersSetBeforeDoFilter = filterConfig.getInitParameter("responseHeadersSetBeforeDoFilter");
    if (StringUtils.isNotBlank(responseHeadersSetBeforeDoFilter)) {
       ECSideFilter.responseHeadersSetBeforeDoFilter = Boolean.valueOf(responseHeadersSetBeforeDoFilter).booleanValue();
    }

}

From source file:org.projectforge.business.user.filter.UserFilter.java

@Override
public void init(final FilterConfig filterConfig) throws ServletException {
    WebApplicationContext springContext = WebApplicationContextUtils
            .getRequiredWebApplicationContext(filterConfig.getServletContext());
    final AutowireCapableBeanFactory beanFactory = springContext.getAutowireCapableBeanFactory();
    beanFactory.autowireBean(this);
    CONTEXT_PATH = filterConfig.getServletContext().getContextPath();
    WICKET_PAGES_PREFIX = CONTEXT_PATH + "/" + Const.WICKET_APPLICATION_PATH;
    // IGNORE_PREFIX_WICKET = WICKET_PAGES_PREFIX + "resources";
    // IGNORE_PREFIX_DOC = contextPath + "/secure/doc";
    // IGNORE_PREFIX_SITE_DOC = contextPath + "/secure/site";
    IGNORE_PREFIX_LOGO = CONTEXT_PATH + "/" + LogoServlet.BASE_URL;
    IGNORE_PREFIX_SMS_REVEIVE_SERVLET = CONTEXT_PATH + "/" + SMSReceiverServlet.URL;
}

From source file:com.evon.injectTemplate.InjectTemplateFilter.java

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

    try {//from  ww  w  . j a v  a 2s  .c  o  m
        contentTypes = new ConcurrentHashMap<>();
        templates = new ConcurrentHashMap<>();

        TemplateConfig.load(filterConfig.getServletContext());

        printConfig();
    } catch (TemplateException e) {
        e.printStackTrace();
        throw new ServletException(e.getMessage(), e);
    }
}

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

/**
 * A hook to give subclass another way to create ActionFactory
 *
 * @param filterConfig ?//from  ww  w  .  ja v a 2  s.  c  om
 *
 * @return ActionFactory bean.
 */
@Override
protected ActionFactory createActionFactory(final FilterConfig filterConfig) {
    log.info("Load configuration location : " + configLocation);
    Configuration configuration = new Configuration();
    configuration.load(configLocation);
    if (useSpringObjectFactory) {
        Map<String, Object> actionFactoryProperties = new HashMap<String, Object>(2);
        actionFactoryProperties.put("objectFactory", new SpringObjectFactory(
                WebApplicationContextUtils.getRequiredWebApplicationContext(filterConfig.getServletContext())));
        configuration.addActionFactoryProperties(actionFactoryProperties);
    }
    return configuration.buildActionFactory();
}

From source file:org.auraframework.http.AuraContextFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    String dirConfig = filterConfig.getInitParameter("componentDir");
    if (!AuraTextUtil.isNullEmptyOrWhitespace(dirConfig)) {
        componentDir = filterConfig.getServletContext().getRealPath("/") + dirConfig;
    }// w w  w. j a v a  2 s  .  c  om
}

From source file:org.apache.wiki.ui.WikiJSPFilter.java

/** {@inheritDoc} */
public void init(FilterConfig config) throws ServletException {
    super.init(config);
    m_wiki_encoding = m_engine.getWikiProperties().getProperty(WikiEngine.PROP_ENCODING);
    ServletContext context = config.getServletContext();
    m_useOutputStream = UtilJ2eeCompat.useOutputStream(context.getServerInfo());
}