Package com.google.inject.servlet
Class GuiceFilter
- java.lang.Object
-
- com.google.inject.servlet.GuiceFilter
-
- All Implemented Interfaces:
Filter
public class GuiceFilter extends Object implements Filter
Apply this filter in web.xml above all other filters (typically), to all requests where you plan to use servlet scopes. This is also needed in order to dispatch requests to injectable filters and servlets:<filter> <filter-name>guiceFilter</filter-name> <filter-class>com.google.inject.servlet.GuiceFilter</filter-class> </filter> <filter-mapping> <filter-name>guiceFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
This filter must appear before every filter that makes use of Guice injection or servlet scopes functionality. Typically, you will only register this filter in web.xml and register any other filters (and servlets) using aServletModule
.
-
-
Constructor Summary
Constructors Constructor Description GuiceFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
void
init(FilterConfig filterConfig)
-
-
-
Method Detail
-
doFilter
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
- Specified by:
doFilter
in interfaceFilter
- Throws:
IOException
ServletException
-
init
public void init(FilterConfig filterConfig) throws ServletException
- Specified by:
init
in interfaceFilter
- Throws:
ServletException
-
-