• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
20 import java.io.IOException;
21 
22 import javax.servlet.FilterChain;
23 import javax.servlet.ServletContext;
24 import javax.servlet.ServletException;
25 import javax.servlet.ServletRequest;
26 import javax.servlet.ServletResponse;
27 
28 /**
29  * An internal dispatcher for guice-servlet registered servlets and filters.
30  * By default, we assume a Guice 1.0 style servlet module is in play. In other
31  * words, we dispatch directly to the web.xml pipeline after setting up scopes.
32  *
33  * <p>
34  * If on the other hand, {@link ServletModule} is used to register managed
35  * servlets and/or filters, then a different pipeline is bound instead. Which,
36  * after dispatching to Guice-injected filters and servlets continues to the web.xml
37  * pipeline (if necessary).
38  *
39  * @author dhanji@gmail.com (Dhanji R. Prasanna)
40  */
41 @ImplementedBy(DefaultFilterPipeline.class)
42 interface FilterPipeline {
initPipeline(ServletContext context)43   void initPipeline(ServletContext context) throws ServletException;
destroyPipeline()44   void destroyPipeline();
45 
dispatch(ServletRequest request, ServletResponse response, FilterChain defaultFilterChain)46   void dispatch(ServletRequest request, ServletResponse response,
47       FilterChain defaultFilterChain) throws IOException, ServletException;
48 }
49