public class HiveMindFilter extends java.lang.Object implements javax.servlet.Filter
ThreadEventNotifier.fireThreadCleanup()
. It also makes the
Registry available during the request by storing it as a request attribute.Constructor and Description |
---|
HiveMindFilter() |
Modifier and Type | Method and Description |
---|---|
protected void |
addWebInfDescriptor(javax.servlet.ServletContext context,
ClassResolver resolver,
RegistryBuilder builder)
Invoked from
constructRegistry(FilterConfig) to add WEB-INF/hivemodule.xml to
the registry, if it exists. |
protected Registry |
constructRegistry(javax.servlet.FilterConfig config)
Invoked from
init(FilterConfig) to actually construct the Registry. |
void |
destroy()
Invokes
Registry.shutdown() . |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
Passes the request to the filter chain, but then invokes
Registry.cleanupThread()
(from a finally block). |
protected ModuleDescriptorProvider |
getModuleDescriptorProvider(ClassResolver resolver)
Returns the
ModuleDescriptorProvider to be used to construct the Registry. |
static Registry |
getRegistry(javax.servlet.http.HttpServletRequest request)
Returns the
Registry that was stored as a request attribute inside method
doFilter(ServletRequest, ServletResponse, FilterChain) . |
protected java.util.Locale |
getRegistryLocale()
Returns the default Locale.
|
void |
init(javax.servlet.FilterConfig config)
Constructs a
Registry and stores it into the ServletContext . |
static void |
rebuildRegistry(javax.servlet.http.HttpServletRequest request)
Sets a flag in the request that will cause the current Registry to be shutdown and replaced
with a new Registry (at the end of the current request).
|
public HiveMindFilter()
public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException
Registry
and stores it into the ServletContext
. Any
exception throws is logged.init
in interface javax.servlet.Filter
javax.servlet.ServletException
protected Registry constructRegistry(javax.servlet.FilterConfig config)
init(FilterConfig)
to actually construct the Registry. Subclasses may
override if they have specific initialization needs, or have nonstandard rules for finding
HiveMind module deployment descriptors.protected void addWebInfDescriptor(javax.servlet.ServletContext context, ClassResolver resolver, RegistryBuilder builder)
constructRegistry(FilterConfig)
to add WEB-INF/hivemodule.xml to
the registry, if it exists.protected java.util.Locale getRegistryLocale()
protected ModuleDescriptorProvider getModuleDescriptorProvider(ClassResolver resolver)
ModuleDescriptorProvider
to be used to construct the Registry. This
implementation returns the default XmlModuleDescriptorProvider
. May be overridden by
subclasses.public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException
Registry.cleanupThread()
(from a finally block).doFilter
in interface javax.servlet.Filter
java.io.IOException
javax.servlet.ServletException
public void destroy()
Registry.shutdown()
.destroy
in interface javax.servlet.Filter
public static Registry getRegistry(javax.servlet.http.HttpServletRequest request)
Registry
that was stored as a request attribute inside method
doFilter(ServletRequest, ServletResponse, FilterChain)
.public static void rebuildRegistry(javax.servlet.http.HttpServletRequest request)