1 24 package org.riotfamily.common.web.filter; 25 26 import java.io.IOException ; 27 28 import javax.servlet.FilterChain ; 29 import javax.servlet.ServletException ; 30 import javax.servlet.http.HttpServletRequest ; 31 import javax.servlet.http.HttpServletResponse ; 32 33 39 public class PluginChain { 40 41 private FilterChain filterChain; 42 43 private FilterPlugin[] plugins; 44 45 private int nextPlugin = 0; 46 47 public PluginChain(FilterChain filterChain, FilterPlugin[] plugins) { 48 this.filterChain = filterChain; 49 this.plugins = plugins; 50 } 51 52 public void doFilter(HttpServletRequest request, 53 HttpServletResponse response) 54 throws IOException , ServletException { 55 56 if (nextPlugin < plugins.length) { 57 plugins[nextPlugin++].doFilter(request, response, this); 58 } 59 else { 60 filterChain.doFilter(request, response); 61 } 62 } 63 } 64 | Popular Tags |