|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.nanocontainer.nanowar.ServletContainerProxyFilter
ServletContainerProxyFilter is a Filter which delegates to any Filter which is registered in a PicoContainer, in any of the web scopes: context, session or request. This form of delegation is particularly useful as it brings dependency injections to filters. In fact the delegate filter may be implemented via any form of dependency injection.
The delegate Filter must be registered via the delegate-key
or delegate-class
init-params of this Filter.
The initialization is done lazily, using the init-type
init-param
to control it. Allowed values are:
The lookup in the PicoContainer is by default done for each request, but you
can control that behaviour with the lookup-only-once
init-param.
If set to "true", ServletContainerProxyFilter will only lookup your delegate filter
at the first request.
Note: Be aware that any dependency on your filter, in this setup, will stay referenced by your filter for its whole lifetime, even though this dependency might have been set up at request level in your composer!
Constructor Summary | |
ServletContainerProxyFilter()
|
Method Summary | |
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain filterChain)
|
void |
init(javax.servlet.FilterConfig filterConfig)
|
protected void |
initDelegate()
|
protected void |
lookupDelegate(javax.servlet.http.HttpServletRequest request)
Looks up delegate Filter in PicoContainer found in any of the web scopes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ServletContainerProxyFilter()
Method Detail |
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
protected void initDelegate() throws javax.servlet.ServletException
javax.servlet.ServletException
protected void lookupDelegate(javax.servlet.http.HttpServletRequest request)
request
- the HttpServletRequest used to find the PicoContainer
org.picocontainer.PicoInitializationException
- if the delegate Filter cannot be found
|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |