Refine search
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { if(position==filters.length) { // reached to the end chain.doFilter(request,response); } else { // call next filters[position++].doFilter(request,response,this); } } }.doFilter(request,response);
/** * 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 destroy() { this.delegate.destroy(); }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (wrappedFilter == null) { throw new ServletException("No wrappedFilter configured"); } if (this.enable) { this.wrappedFilter.doFilter(request, response, chain); } else { chain.doFilter(request, response); } }
throw new ServletException( "Filters must be bound as singletons. " + filterKey filter.init( new FilterConfig() { @Override
protected void deployNewFilter(Filter newFilter) throws ServletException { Filter oldFilter = filter; if (newFilter == null) { throw new ServletException("Cannot deploy null filter"); } newFilter.init(filterConfig); filter = newFilter; if (oldFilter != null) { oldFilter.destroy(); } }
try { filter = filterConfig.getFilter(); filter.doFilter(request, response, this); } catch (IOException e) { throw e; throw e; } catch (Throwable e) { throw new ServletException("Throwable", e); servlet.service(request, response); } else { RequestDispatcher rd = configImpl.getServletContext().getNamedDispatcher("default"); if (rd == null) { throw new ServletException("No Servlet Found"); throw e; } catch (Throwable e) { throw new ServletException("Throwable", e);
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (!initialized) { throw new ServletException(getClass().getName() + ".init(FilterConfig) was not called"); } reloadIfNecessary(); filter.doFilter(servletRequest, servletResponse, filterChain); }
/** * Pass the call on to the Filter/Servlet. */ @Override public void doFilter(ServletRequest request, ServletResponse response) throws ServletException, IOException { if (this.filter != null) { this.filter.doFilter(request, response, this.nextFilterChain); } else { Assert.state(this.servlet != null, "Neither a Filter not a Servlet set"); this.servlet.service(request, response); } }
/** * Actually invoke the delegate Filter with the given request and response. * @param delegate the delegate Filter * @param request the current HTTP request * @param response the current HTTP response * @param filterChain the current FilterChain * @throws ServletException if thrown by the Filter * @throws IOException if thrown by the Filter */ protected void invokeDelegate( Filter delegate, ServletRequest request, ServletResponse response, FilterChain filterChain) throws ServletException, IOException { delegate.doFilter(request, response, filterChain); }
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); }
/** * 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; } }
@Test public void testInit() { Filter filter = makeFilter(); try { filter.init(makeFilterConfig()); } catch (ServletException e) { assertNotNull(e.getMessage()); } finally { filter.destroy(); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { if (wrappedFilter == null) { throw new ServletException("No wrappedFilter configured"); } if (this.enable) { this.wrappedFilter.init(filterConfig); } }
protected void deployNewFilter(Filter newFilter) throws ServletException { Filter oldFilter = filter; if (newFilter == null) { throw new ServletException("Cannot deploy null filter"); } newFilter.init(filterConfig); filter = newFilter; if (oldFilter != null) { oldFilter.destroy(); } }
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (!initialized) { throw new ServletException(getClass().getName() + ".init(FilterConfig) was not called"); } reloadIfNecessary(); filter.doFilter(servletRequest, servletResponse, filterChain); }
/** * Pass the call on to the Filter/Servlet. */ @Override public void doFilter(ServletRequest request, ServletResponse response) throws ServletException, IOException { if (this.filter != null) { this.filter.doFilter(request, response, this.nextFilterChain); } else { Assert.state(this.servlet != null, "Neither a Filter not a Servlet set"); this.servlet.service(request, response); } }