@Before public void testInitialize() { wrapperUnderTest = new ApplicationInsightsHttpResponseWrapper(responseMock); }
/** * Processing the given request and response. * * @param req The servlet request. * @param res The servlet response. * @param chain The filters chain * @throws IOException Exception that can be thrown from invoking the filters chain. * @throws ServletException Exception that can be thrown from invoking the filters chain. */ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { ApplicationInsightsHttpResponseWrapper response = new ApplicationInsightsHttpResponseWrapper((HttpServletResponse) res); setKeyOnTLS(key); boolean isRequestProcessedSuccessfully = invokeSafeOnBeginRequest(req, response); try { chain.doFilter(req, response); invokeSafeOnEndRequest(req, response, isRequestProcessedSuccessfully); } catch (ServletException se) { onException(se, req, response, isRequestProcessedSuccessfully); throw se; } catch (IOException ioe) { onException(ioe, req, response, isRequestProcessedSuccessfully); throw ioe; } catch (RuntimeException re) { onException(re, req, response, isRequestProcessedSuccessfully); throw re; } finally { cleanup(); } }
/** * Processing the given request and response. * * @param req The servlet request. * @param res The servlet response. * @param chain The filters chain * @throws IOException Exception that can be thrown from invoking the filters chain. * @throws ServletException Exception that can be thrown from invoking the filters chain. */ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { ApplicationInsightsHttpResponseWrapper response = new ApplicationInsightsHttpResponseWrapper((HttpServletResponse) res); setKeyOnTLS(key); boolean isRequestProcessedSuccessfully = invokeSafeOnBeginRequest(req, response); try { chain.doFilter(req, response); invokeSafeOnEndRequest(req, response, isRequestProcessedSuccessfully); } catch (ServletException se) { onException(se, req, response, isRequestProcessedSuccessfully); throw se; } catch (IOException ioe) { onException(ioe, req, response, isRequestProcessedSuccessfully); throw ioe; } catch (RuntimeException re) { onException(re, req, response, isRequestProcessedSuccessfully); throw re; } finally { cleanup(); } }