public class EagerBeansFilter extends HttpFilter
A servlet Filter that can be used as alternative for EagerBeansWebListener
.
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 EagerBeansWebListener
main function (instantiating request and session scoped
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
request
- The HTTP request.response
- The HTTP response.session
- The HTTP session, if any, else null
.chain
- The filter chain to continue.ServletException
- As wrapper exception when something fails in the request processing.IOException
- Whenever something fails at I/O level.Filter.doFilter(ServletRequest, ServletResponse, FilterChain)
Copyright © 2012–2016 OmniFaces. All rights reserved.