net.sourceforge.hiveutils.web
Class HiveMindRegistryPublishFilter
java.lang.Object
net.sourceforge.hiveutils.web.HiveMindRegistryPublishFilter
- All Implemented Interfaces:
- javax.servlet.Filter
public class HiveMindRegistryPublishFilter
- extends java.lang.Object
- implements javax.servlet.Filter
Servlet Filter that allows retrieval of HiveMind Registry from
any code location executed in the current thread without needing access to
the ServletRequest.
It should be put in second position right after the standard
HiveMindFilter.
It copies the current Registry to a ThreadLocal,
making it accessible through a static method with no argument.
You should use this Filter only if you have some code that needs to
access HiveMind Registry, but cannot have access to the current
ServletRequest, eg if you use SecurityFilter (from Max Cooper),
and your SecurityRealm needs to access the Registry (generally
it would need to).
- Author:
- Jean-Francois Poilpret
|
Field Summary |
protected static java.lang.ThreadLocal<org.apache.hivemind.Registry> |
_localRegistry
|
|
Method Summary |
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
|
static org.apache.hivemind.Registry |
getRegistry()
Gets the HiveMind Registry assigned to the current thread. |
void |
init(javax.servlet.FilterConfig config)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_localRegistry
protected static java.lang.ThreadLocal<org.apache.hivemind.Registry> _localRegistry
HiveMindRegistryPublishFilter
public HiveMindRegistryPublishFilter()
getRegistry
public static org.apache.hivemind.Registry getRegistry()
- Gets the HiveMind
Registry assigned to the current thread.
No argument is required.
init
public void init(javax.servlet.FilterConfig config)
throws javax.servlet.ServletException
- Specified by:
init in interface javax.servlet.Filter
- Throws:
javax.servlet.ServletException
destroy
public void destroy()
- Specified by:
destroy in interface javax.servlet.Filter
doFilter
public void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws java.io.IOException,
javax.servlet.ServletException
- Specified by:
doFilter in interface javax.servlet.Filter
- Throws:
java.io.IOException
javax.servlet.ServletException