This is what I'm getting in the browser after the page makes an Ajax request and the session has been timeout, I'm implementing OmniFaces FullAjaxExceptionHandler
.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<partial-response id="j_id1"> <changes> <update id="javax.faces.ViewRoot"> <![CDATA[ <html xmlns="http://www.w3.org/1999/xhtml"><head><link type="text/css" rel="stylesheet" href="/WebWorkflow/javax.faces.resource/theme.css.xhtml?ln=primefaces-smoothness" /><link type="text/css" rel="stylesheet" href="/WebWorkflow/javax.faces.resource/css/xpm2.css.xhtml" /><script type="text/javascri ]]> <![CDATA[ pt" src="/WebWorkflow/javax.faces.resource/jquery/jquery.js.xhtml?ln=primefaces&v=5.1.13&v=5.1.13"></script><script type="text/javascript" src="/WebWorkflow/javax.faces.resource/primefaces.js.xhtml?ln=primefaces&v=5.1.13&v=5.1.13"></script><link type="text/css" rel="stylesheet" href="/WebWorkflow/javax.faces.resource/primefaces.css.xhtml?ln=primefaces&v=5.1.13&v=5.1.13" /><script type="text/javascript" src="/WebWorkflow/javax.faces.resource/jquery/jquery-plugins.js.xhtml?ln=primefaces&v=5.1.13&v=5.1.13"></script> <meta http-equiv="cache-control" content="max-age=0" /> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /> <meta http-equiv="pragma" content="no-cache" /><script type="text/javascript" src="/WebWorkflow/javax.faces.resource/jsf.js.xhtml?ln=js"></script> <title>XPM </title></head><body><span id="j_idt10"><script language="javascript" type="text/javascript"> function faceletsDebug(URL) {day = new Date();id = day.getTime();eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 240,top = 212');"); };(function() { if (typeof jsfFaceletsDebug === 'undefined') { var jsfFaceletsDebug = false; } if (!jsfFaceletsDebug) {var faceletsOrigKeyup = document.onkeyup;document.onkeyup = function(e) { if (window.event) e = window.event; if (String.fromCharCode(e.keyCode) == 'D' & e.shiftKey & e.ctrlKey) faceletsDebug('/WebWorkflow/error/expired.xhtml?facelets.ui.DebugOutput=1429028952601'); jsfFaceletsDebug = true; if (faceletsOrigKeyup) faceletsOrigKeyup(e); }; }})();</script></span> <div id="wrapper"> <div id="header"> <form id="headerForm" name="headerForm" method="post" action="/WebWorkflow/error/expired.xhtml" enctype="application/x-www-form-urlencoded"> <input type="hidden" name="headerForm" value="headerForm" /> <div id="headerContent"><img src="/WebWorkflow/javax.faces.resource/img/wf-logo.gif.xhtml" alt="" /><img src="/WebWorkflow/javax.faces.resource/img/header.gif.xhtml" alt="" /> <div id="welcome"> </div> </div> </form> </div> <div id="section"><div id="exceptionDialog" class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-shadow ui-hidden-container"><div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top"><span id="exceptionDialog_title" class="ui-dialog-title">Exception: occured!</span><a href="#" class="ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all"><span class="ui-icon ui-icon-closethick"></span></a></div><div class="ui-dialog-content ui-widget-content"> Message: <br /> StackTrace: <button id="j_idt23" name="j_idt23" type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="document.location.href = document.location.href;;window.open('/WebWorkflow/error/expired.xhtml','_self')"><span class="ui-button-text ui-c">Reload!</span></button><script id="j_idt23_s" type="text/javascript">PrimeFaces.cw("Button","widget_j_idt23",{id:"j_idt23",widgetVar:"widget_j_idt23"});</script></div></div><script id="exceptionDialog_s" type="text/javascript">$(function(){PrimeFaces.cw("Dialog","exceptionDialog",{id:"exceptionDialog",widgetVar:"exceptionDialog",height:"500px"});});</script> <div id="sectionContent"> <form id="j_idt25" name="j_idt25" method="post" action="/WebWorkflow/error/expired.xhtml" enctype="application/x-www-form-urlencoded"> <input type="hidden" name="j_idt25" value="j_idt25" /> Your session has expired. You were on page <a href="/WebWorkflow/faces/web/index.xhtml">Back to login page</a> </form> </div> </div> <div id="footer"> <div id="footerContent"><img src="/WebWorkflow/javax.faces.resource/img/stagecoachsignature.gif.xhtml" alt="" /> <ul> <li><a href="/WebWorkflow/faces/web/index.xhtml"> About My Company </a> </li> <li><a href="/WebWorkflow/faces/web/index.xhtml"> PRIVACY, Cookies, Security, Legal </a> </li> <li><a href="/WebWorkflow/faces/web/index.xhtml"> Online Access Agreement </a> </li> <li><a href="/WebWorkflow/faces/web/index.xhtml"> Contact Us </a> </li> </ul> </div> </div> </div></body> </html> ]]> </update> <update id="j_id1:javax.faces.ViewState:0"> <![CDATA[ -1772475063786038199:-292459209620208926 ]]> </update> </changes> </partial-response>
This is the error shown in the console:
FullAjaxExceptionHandler: An exception occurred during processing JSF ajax request. Error page '/errorpages/expired.xhtml' will be shown.: javax.faces.application.ViewExpiredException: viewId:/login.xhtml - View /login.xhtml could not be restored.
I solved by disabling FullAjaxExceptionHandler and implementing my own ViewExpiredExceptionHandler (ExceptionHandlerWrapper), and hardcoding the response in case of an Ajax request.
The Douglas Junior answer from this post is what worked for me: Session timeout and ViewExpiredException handling on JSF/PrimeFaces ajax request
Now I have another problem with the redirects, but that would be another post, thanks guys for the help.