Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CancellableRequestFilter implements Filter {
- public void init(FilterConfig filterConfig) throws ServletException {
- }
- public void destroy() {
- }
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
- try {
- chain.doFilter(request, response);
- } catch (ServletRequestAbortException e) {
- //TODO: Maybe flush/close response here.
- }
- }
- public static void endRequest() {
- throw new ServletRequestAbortException();
- }
- public static class ServletRequestAbortException extends RuntimeException {
- }
- }
- <% com.your.pkg.CancellableRequestFilter.endRequest(); %>
Add Comment
Please, Sign In to add comment