you should put a timeout in your web.xml and register a timeout filter, as shown in this thread: Automatically shutdown in the JSF application in case of ajax, your redirection should be done as follows:
String facesRequestHeader = httpServletRequest .getHeader( "Faces-Request" ); boolean isAjaxRequest = facesRequestHeader != null && facesRequestHeader.equals( "partial/ajax" ); if( isAjaxRequest ) { String url = MessageFormat.format( "{0}://{1}:{2,number,####0}{3}", request.getScheme(), request.getServerName(), request.getServerPort(), timeoutPath ); PrintWriter pw = response.getWriter(); pw.println( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ); pw.println( "<partial-response><redirect url=\"" + url + "\"></redirect></partial-response>" ); pw.flush();); } else { httpServletResponse.sendRedirect( timeoutPath ); }
Oscar Castiblanco
source share