1 /* 2 * Copyright (C) 2008 Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.inject.servlet; 17 18 import com.google.inject.ImplementedBy; 19 import java.io.IOException; 20 import javax.servlet.FilterChain; 21 import javax.servlet.ServletContext; 22 import javax.servlet.ServletException; 23 import javax.servlet.ServletRequest; 24 import javax.servlet.ServletResponse; 25 26 /** 27 * An internal dispatcher for guice-servlet registered servlets and filters. By default, we assume a 28 * Guice 1.0 style servlet module is in play. In other words, we dispatch directly to the web.xml 29 * pipeline after setting up scopes. 30 * 31 * <p>If on the other hand, {@link ServletModule} is used to register managed servlets and/or 32 * filters, then a different pipeline is bound instead. Which, after dispatching to Guice-injected 33 * filters and servlets continues to the web.xml pipeline (if necessary). 34 * 35 * @author dhanji@gmail.com (Dhanji R. Prasanna) 36 */ 37 @ImplementedBy(DefaultFilterPipeline.class) 38 interface FilterPipeline { initPipeline(ServletContext context)39 void initPipeline(ServletContext context) throws ServletException; 40 destroyPipeline()41 void destroyPipeline(); 42 dispatch(ServletRequest request, ServletResponse response, FilterChain defaultFilterChain)43 void dispatch(ServletRequest request, ServletResponse response, FilterChain defaultFilterChain) 44 throws IOException, ServletException; 45 } 46