/** * Initialize all the filters, calling each one's init method in turn in the order supplied. * @see Filter#init(FilterConfig) */ @Override public void init(FilterConfig config) throws ServletException { for (Filter filter : this.filters) { filter.init(config); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { this.delegate.init(filterConfig); }
@Override public void init(FilterConfig filterConfig) throws ServletException { delegate.init(filterConfig); }
/** * Initialize all the filters, calling each one's init method in turn in the order supplied. * @see Filter#init(FilterConfig) */ @Override public void init(FilterConfig config) throws ServletException { for (Filter filter : this.filters) { filter.init(config); } }
public void init(FilterConfig filterConfig) throws ServletException { if (LOGGER.isLoggable(Level.FINEST)) for (Filter f : filters) LOGGER.finest("ChainedServletFilter contains: " + f); for (Filter f : filters) f.init(filterConfig); }
public void init(FilterConfig config) throws ServletException { this.config = config; synchronized (LEGACY) { list.addAll(LEGACY); LEGACY.clear(); } for (Filter f : list) { f.init(config); } config.getServletContext().setAttribute(KEY,this); }
public static void addFilter(Filter filter) throws ServletException { Jenkins j = Jenkins.getInstanceOrNull(); PluginServletFilter container = null; if(j != null) { container = getInstance(j.servletContext); } // https://marvelution.atlassian.net/browse/JJI-188 if (j==null || container == null) { // report who is doing legacy registration LOGGER.log(Level.WARNING, "Filter instance is registered too early: "+filter, new Exception()); LEGACY.add(filter); } else { filter.init(container.config); container.list.add(filter); } }
@Override public void init(final FilterConfig filterConfig) throws ServletException { wrappedFilter.init(new FilterConfigWrapper(filterConfig)); }
/** * Initialize the Filter delegate, defined as bean the given Spring * application context. * <p>The default implementation fetches the bean from the application context * and calls the standard {@code Filter.init} method on it, passing * in the FilterConfig of this Filter proxy. * @param wac the root application context * @return the initialized delegate Filter * @throws ServletException if thrown by the Filter * @see #getTargetBeanName() * @see #isTargetFilterLifecycle() * @see #getFilterConfig() * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) */ protected Filter initDelegate(WebApplicationContext wac) throws ServletException { String targetBeanName = getTargetBeanName(); Assert.state(targetBeanName != null, "No target bean name set"); Filter delegate = wac.getBean(targetBeanName, Filter.class); if (isTargetFilterLifecycle()) { delegate.init(getFilterConfig()); } return delegate; }
/** * Initialize the {@link Filter} * * @throws javax.servlet.ServletException */ public void init() throws ServletException { for (FilterConfigImpl f : filters) { if (f != null) { f.getFilter().init(f); } } if (servlet != null) { servlet.init(configImpl); } }
/** * Initializes the filter by calling <code>filter.init( {@link #getFilterConfig() getFilterConfig()} );</code>. * * @param filter the filter to initialize with the {@code FilterConfig}. */ protected void initFilter(Filter filter) { FilterConfig filterConfig = getFilterConfig(); if (filterConfig == null) { throw new IllegalStateException("FilterConfig attribute has not been set. This must occur before filter " + "initialization can occur."); } try { filter.init(filterConfig); } catch (ServletException e) { throw new ConfigurationException(e); } }
public static Map<String, Filter> createInstanceMap(FilterConfig config) { Map<String, Filter> filters = new LinkedHashMap<String, Filter>(values().length); for (DefaultFilter defaultFilter : values()) { Filter filter = defaultFilter.newInstance(); if (config != null) { try { filter.init(config); } catch (ServletException e) { String msg = "Unable to correctly init default filter instance of type " + filter.getClass().getName(); throw new IllegalStateException(msg, e); } } filters.put(defaultFilter.name(), filter); } return filters; } }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (proxy == null) { synchronized (lock) { if (proxy == null) { Ioc ioc = Mvcs.ctx().getDefaultIoc(); Filter proxy = ioc.get(null, beanName); proxy.init(filterConfig); this.proxy = proxy; } } } proxy.doFilter(request, response, chain); }
/** * Initialize the Filter delegate, defined as bean the given Spring * application context. * <p>The default implementation fetches the bean from the application context * and calls the standard {@code Filter.init} method on it, passing * in the FilterConfig of this Filter proxy. * @param wac the root application context * @return the initialized delegate Filter * @throws ServletException if thrown by the Filter * @see #getTargetBeanName() * @see #isTargetFilterLifecycle() * @see #getFilterConfig() * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) */ protected Filter initDelegate(WebApplicationContext wac) throws ServletException { String targetBeanName = getTargetBeanName(); Assert.state(targetBeanName != null, "No target bean name set"); Filter delegate = wac.getBean(targetBeanName, Filter.class); if (isTargetFilterLifecycle()) { delegate.init(getFilterConfig()); } return delegate; }
( (Filter) instance ).init( new FilterConfig()
/** * Reset the proxies and filter for a change in {@link SecurityRealm}. */ public void reset(SecurityRealm securityRealm) throws ServletException { if (securityRealm != null) { SecurityRealm.SecurityComponents sc = securityRealm.getSecurityComponents(); AUTHENTICATION_MANAGER.setDelegate(sc.manager); USER_DETAILS_SERVICE_PROXY.setDelegate(sc.userDetails); REMEMBER_ME_SERVICES_PROXY.setDelegate(sc.rememberMe); // make sure this.filter is always a valid filter. Filter oldf = this.filter; Filter newf = securityRealm.createFilter(this.filterConfig); newf.init(this.filterConfig); this.filter = newf; if(oldf!=null) oldf.destroy(); } else { // no security related filter needed. AUTHENTICATION_MANAGER.setDelegate(null); USER_DETAILS_SERVICE_PROXY.setDelegate(null); REMEMBER_ME_SERVICES_PROXY.setDelegate(null); filter = null; } }
/** * Initializes the wrapped filter and sets the <code>isFilterInitialized</code> property to true. This should be called * before invoking a filter if the result of the <code>isFilterInitialized()</code> method is false. * @throws ServletException Propagates any servlet exception thrown by the filter initialization */ public void init() throws ServletException { this.getFilter().init(filterConfig); this.filterInitialized = true; }
protected void setupFilter() throws ServletException { MockFilterConfig config = new MockFilterConfig(); config.addInitParameter(ProcessEngineAuthenticationFilter.AUTHENTICATION_PROVIDER_PARAM, HttpBasicAuthenticationProvider.class.getName()); authenticationFilter = new ProcessEngineAuthenticationFilter(); authenticationFilter.init(config); }
@Test public void testLifeCycle() throws ServletException { Filter filter = makeFilter(); try { filter.init(makeFilterConfig()); } finally { filter.destroy(); } }
@Test public void testFilterBasic() throws ServletException, IOException { Filter filter = makeFilter(); try { filter.init(makeFilterConfig()); filter.doFilter(makeRequest(), makeResponse(), makeFilterChain()); } finally { filter.destroy(); } }