public void init(FilterConfig config) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException {
fireEvent(new InternalServletResponseEvent(response), InitializedLiteral.INSTANCE);
Path path = null;
if (request instanceof HttpServletRequest) {
path = new PathLiteral(HttpServletRequest.class.cast(request).getServletPath());
fireEvent(response, InitializedLiteral.INSTANCE, path);
fireEvent(new HttpServletRequestContext(request, response), InitializedLiteral.INSTANCE, path);
} else {
fireEvent(response, InitializedLiteral.INSTANCE);
fireEvent(new ServletRequestContext(request, response), InitializedLiteral.INSTANCE);
}
try {
if (!response.isCommitted()) {
chain.doFilter(request, response);
}
} finally {
if (request instanceof HttpServletRequest) {
fireEvent(response, DestroyedLiteral.INSTANCE, path);
fireEvent(new HttpServletRequestContext(request, response), DestroyedLiteral.INSTANCE, path);
} else {
fireEvent(response, DestroyedLiteral.INSTANCE);
fireEvent(new ServletRequestContext(request, response), DestroyedLiteral.INSTANCE);
}
fireEvent(new InternalServletResponseEvent(response), DestroyedLiteral.INSTANCE);
}
}