View Javadoc

1   package com.bradmcevoy.http;
2   
3   /** Passes the request and response along a series of filters
4    *
5    *  By default the HttpManager loads a single filter which executes the appropriate
6    *  handler for the http method
7    *
8    *  Additional filters can be added using HttpManager.addFilter
9    */
10  public class FilterChain {
11      
12      final HttpManager httpManager;
13      int pos = 0;
14      
15      public FilterChain(HttpManager httpManager) {
16          this.httpManager = httpManager;
17      }
18  
19      public void process( Request request, Response response) {        
20          Filter filter = httpManager.filters.get(pos++);
21          filter.process(this,request,response);
22      }
23  
24      public HttpManager getHttpManager() {
25          return httpManager;
26      }
27         
28  }