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:com.pocketgorilla.stripesem.TransactionFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    ServletContext servletContext = filterConfig.getServletContext();
    provider = JPAProvider.getProviderForApplication(servletContext);
}

From source file:och.front.web.filter.SecurityFilter.java

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

    app = FrontAppProvider.get(filterConfig.getServletContext());
    security = app.security;/* ww w.j  a v  a2 s  . co m*/

}

From source file:org.smigo.config.RequestLogFilter.java

@Override
public void init(FilterConfig config) throws ServletException {
    ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(config.getServletContext());
    logHandler = ctx.getBean(LogHandler.class);
}

From source file:at.molindo.notify.servlet.NotifyFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    _notifyFilterBean = findNotifyFilterBean(findWebApplicationContext(filterConfig.getServletContext()));
    if (_notifyFilterBean == null) {
        throw new ServletException("couldn't find NotifyFilterBean");
    }// w  w w.  ja v a  2 s. co m
}

From source file:org.tsm.concharto.web.filter.NotificationFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    this.filterConfig = filterConfig;
    ServletContext ctx = filterConfig.getServletContext();
    WebApplicationContext webAppContext = WebApplicationContextUtils.getWebApplicationContext(ctx);
    notificationDao = (NotificationDao) webAppContext.getBean("notificationDao");
}

From source file:nl.strohalm.cyclos.http.EncodingFilter.java

@Override
public void init(final FilterConfig config) throws ServletException {
    super.init(config);

    context = config.getServletContext();
    settingsService.addListener(this);
    update(SettingsHelper.getLocalSettings(context));
}

From source file:org.sonar.server.platform.ProfilingFilter.java

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

    String staticResourcesConfig = filterConfig.getInitParameter("staticDirs");
    if (StringUtils.isNotBlank(staticResourcesConfig)) {
        staticResourceDirs = ImmutableSet.copyOf(staticResourcesConfig.split(CONFIG_SEPARATOR));
    } else {/*from  w w w.j  a  v a  2s .  c o m*/
        staticResourceDirs = ImmutableSet.of();
    }
}

From source file:org.addsimplicity.anicetus.web.TelemetryServletFilter.java

public void init(FilterConfig config) throws ServletException {
    m_servletContext = config.getServletContext();
    m_sessionContextName = config.getInitParameter("SessionContextName");
    if (m_sessionContextName == null) {
        m_sessionContextName = "sessionContext";
    }/* w  ww. j ava  2 s. c  o m*/
}

From source file:org.wso2.carbon.identity.core.filter.AuthorizationHeaderFilter.java

public void init(FilterConfig fConfig) throws ServletException {

    this.context = fConfig.getServletContext();
    this.context.log("AuthorizationHeaderFilter initialized");
}

From source file:grails.plugin.miniprofiler.sitemesh.grails20.ProfilingGrailsPageFilter.java

@Override
public void init(FilterConfig fc) {
    super.init(fc);
    profilerProvider = WebApplicationContextUtils.getRequiredWebApplicationContext(fc.getServletContext())
            .getBean("profilerProvider", ProfilerProvider.class);

    Field field = null;//  w ww.j a v a  2  s .  co  m
    try {
        field = GrailsPageFilter.class.getDeclaredField("decoratorMapper");
        field.setAccessible(true);
        DecoratorMapper decoratorMapper = (DecoratorMapper) field.get(this);
        field.set(this, new ProfilingDecoratorMapper(decoratorMapper, profilerProvider));
    } catch (NoSuchFieldException e) {
        // different grails version which doesn't have that field?
    } catch (IllegalAccessException e) {
        // just won't work, we're in a security manager
    }
}