public class EagerBeansFilter extends HttpFilter
EagerBeansRequestListener
and EagerBeansSessionListener
This instantiates eager request scoped beans during request processing at the point where this filter is inserted in the chain.
This is needed for those situations where the CDI request scope is NOT available in a ServletRequestListener
,
such as is the case for GlassFish 3 (note that this is not spec compliant, CDI request scope should be available) and where
session scoped beans cannot be instantiated from an HttpSessionListener
such as is the case for GlassFish 3 again.
If this Filter is installed EagerBeansRequestListener
and EagerBeansSessionListener
main function
(instantiating beans) will be automatically disabled.
Naturally this filter should not be enabled for environments where CDI is not available at all.
Constructor and Description |
---|
EagerBeansFilter() |
Modifier and Type | Method and Description |
---|---|
void |
doFilter(HttpServletRequest request,
HttpServletResponse response,
HttpSession session,
FilterChain chain)
Filter the HTTP request.
|
void |
init()
Convenience init() method without FilterConfig parameter which will be called by init(FilterConfig).
|
destroy, doFilter, getFilterConfig, getInitParameter, getServletContext, init
public void init() throws ServletException
HttpFilter
init
in class HttpFilter
ServletException
- When filter's initialization failed.public void doFilter(HttpServletRequest request, HttpServletResponse response, HttpSession session, FilterChain chain) throws ServletException, IOException
HttpFilter
null
if there is no session.doFilter
in class HttpFilter
ServletException
IOException
Filter.doFilter(ServletRequest, ServletResponse, FilterChain)