@Test public void testDoFilter_properXframeOptions() throws Exception { doThrow(new IOException("test")).when(filterChain).doFilter(any(), any()); underTest.doFilter(request, response, filterChain); verify(response).setHeader(X_FRAME_OPTIONS, "DENY"); }
@Override public void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain chain) throws IOException, ServletException { final HttpServletRequest request = (HttpServletRequest) req; final HttpServletResponse response = (HttpServletResponse) resp; try { chain.doFilter(request, response); } catch (Exception e) { ErrorPageServlet.attachCause(request, e); response.setHeader(X_FRAME_OPTIONS, xFrameOptions.getValueForPath(request.getPathInfo())); response.sendError(SC_INTERNAL_SERVER_ERROR); } }
ErrorPageFilter extends ComponentSupport implements Filter { @Override public void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain chain) throws IOException, ServletException { final HttpServletRequest request = (HttpServletRequest) req; final HttpServletResponse response = (HttpServletResponse) resp; try { chain.doFilter(request, response); } catch (Exception e) { ErrorPageServlet.attachCause(request, e); response.setHeader(X_FRAME_OPTIONS, xFrameOptions.getValueForPath(request.getPathInfo())); response.sendError(SC_INTERNAL_SERVER_ERROR); } } }
ErrorPageFilter extends ComponentSupport implements Filter { @Override public void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain chain) throws IOException, ServletException { final HttpServletRequest request = (HttpServletRequest) req; final HttpServletResponse response = (HttpServletResponse) resp; try { chain.doFilter(request, response); } catch (Exception e) { ErrorPageServlet.attachCause(request, e); response.setHeader(X_FRAME_OPTIONS, xFrameOptions.getValueForPath(request.getPathInfo())); response.sendError(SC_INTERNAL_SERVER_ERROR); } } @Inject  ErrorPageFilter(final XFrameOptions xFrameOptions); }
ErrorPageFilter extends ComponentSupport implements Filter { @Override public void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain chain) throws IOException, ServletException { final HttpServletRequest request = (HttpServletRequest) req; final HttpServletResponse response = (HttpServletResponse) resp; try { chain.doFilter(request, response); } catch (Exception e) { ErrorPageServlet.attachCause(request, e); response.setHeader(X_FRAME_OPTIONS, xFrameOptions.getValueForPath(request.getPathInfo())); response.sendError(SC_INTERNAL_SERVER_ERROR); } } @Inject  ErrorPageFilter(final XFrameOptions xFrameOptions); @Override void init(final FilterConfig config); @Override void destroy(); @Override void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain chain); }
ErrorPageFilter extends ComponentSupport implements Filter { @Override public void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain chain) throws IOException, ServletException { final HttpServletRequest request = (HttpServletRequest) req; final HttpServletResponse response = (HttpServletResponse) resp; try { chain.doFilter(request, response); } catch (Exception e) { ErrorPageServlet.attachCause(request, e); response.setHeader(X_FRAME_OPTIONS, xFrameOptions.getValueForPath(request.getPathInfo())); response.sendError(SC_INTERNAL_SERVER_ERROR); } } @Inject  ErrorPageFilter(final XFrameOptions xFrameOptions); @Override void init(final FilterConfig config); @Override void destroy(); @Override void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain chain);  }