// ResponseOutputWriter has buffered up markup that must be discarded. This is because we don't want the
// markup from the original Faces view to be included with the markup of Faces view found in the
// redirect URL.
if (writer instanceof RenderRedirectWriter) {
RenderRedirectWriter responseOutputWriter = (RenderRedirectWriter) writer;
responseOutputWriter.discard();
}
// Recursively call this method with the render-redirect URL so that the RENDER_RESPONSE phase of the
// JSF lifecycle will be re-executed according to the new Faces viewId found in the redirect URL.
execute(bridgeContext.getRenderRedirectURL());