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

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

From source file:org.sonar.server.platform.web.WebPagesFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    String context = filterConfig.getServletContext().getContextPath();
    String indexFile = readIndexFile(filterConfig.getServletContext());
    this.indexDotHtml = indexFile.replaceAll(CONTEXT_PLACEHOLDER, context);
}

From source file:org.soaplab.clients.spinet.filters.DefaultFilter.java

/*************************************************************************
 *
 *************************************************************************/
public void init(FilterConfig filterConfig) throws ServletException {
    this.servletContext = filterConfig.getServletContext();
    this.defaultRequestDispatcher = this.servletContext.getNamedDispatcher("default");
}

From source file:controllers.AuthFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    this.context = filterConfig.getServletContext();
    this.context.log("RequestLoggingFilter initialized");
}

From source file:org.apache.archiva.redback.integration.filter.SpringServletFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    applicationContext = WebApplicationContextUtils.getWebApplicationContext(filterConfig.getServletContext());

}

From source file:org.directwebremoting.faces.FacesExtensionFilter.java

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

From source file:com.music.web.util.RequestBlockingFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    InputStream is = filterConfig.getServletContext().getResourceAsStream("/WEB-INF/classes/bots/agents.txt");
    InputStreamReader reader = new InputStreamReader(is);
    try {//from www .ja va 2s .  c  o  m
        blockedAgents = new HashSet<String>(CharStreams.readLines(reader));
    } catch (IOException ex) {
        throw new IllegalStateException("Failed to load blocked user agents list", ex);
    } finally {
        IOUtils.closeQuietly(reader);
    }
}

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

@Override
public void init(final FilterConfig config) throws ServletException {
    context = config.getServletContext();
    try {/*  www.  ja  va 2 s. c om*/
        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.usefullc.platform.common.filter.WebCommonFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    ServletContext servletContext = filterConfig.getServletContext();
    ServeltContextManager.setServletContext(servletContext);
    WebApplicationContext wc = WebApplicationContextUtils.getWebApplicationContext(servletContext);
    try {// w  w w .  ja v a  2 s .  c  o  m
        actionHandlerInvoke = wc.getBean("actionHandlerInvoke", ActionHandlerInvoke.class);
    } catch (Exception e) {
        actionHandlerInvoke = null;
    }
    if (actionHandlerInvoke != null) {
        interceptorList = actionHandlerInvoke.getInterceptorList();
        canExcute = CollectionUtils.isNotEmpty(interceptorList);
    }

}

From source file:org.red5.logging.LoggerContextFilter.java

public void init(FilterConfig config) throws ServletException {
    ServletContext servletContext = config.getServletContext();
    contextName = servletContext.getContextPath().replaceAll("/", "");
    if ("".equals(contextName)) {
        contextName = "root";
    }//ww  w . j  a  va 2s  .c  o m
    System.out.printf("Filter init: %s%n", contextName);
    ConfigurableWebApplicationContext appctx = (ConfigurableWebApplicationContext) servletContext
            .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    if (appctx != null) {
        System.out.printf(
                "ConfigurableWebApplicationContext is not null in LoggerContextFilter for: %s, this indicates a misconfiguration or load order problem%n",
                contextName);
    }
}