Author: alexsmirnov
Date: 2008-04-18 19:36:14 -0400 (Fri, 18 Apr 2008)
New Revision: 7953
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
Log:
Fix for
http://jira.jboss.com/jira/browse/RF-3102
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2008-04-18
22:16:41 UTC (rev 7952)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2008-04-18
23:36:14 UTC (rev 7953)
@@ -4,6 +4,7 @@
package org.ajax4jsf.context;
import javax.faces.FacesException;
+import javax.faces.application.ViewExpiredException;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -30,6 +31,11 @@
public static final String[] NUMBER_OF_LOGICAL_VIEWS_IN_SESSION =
{"com.sun.faces.numberOfLogicalViews"};
/**
+ * This parameter define where {@link ViewExpiredException} should be handled.
+ * If is it equals "true" , framework should proparate exception to
client-side.
+ */
+ public static final String
HANDLE_VIEW_EXPIRED_ON_CLIENT="org.ajax4jsf.handleViewExpiredOnClient";
+ /**
* Get number of views for store in session by {@link AjaxStateManager}
* @param context - current faces context.
* @return
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-04-18
22:16:41 UTC (rev 7952)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-04-18
23:36:14 UTC (rev 7953)
@@ -43,6 +43,7 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.application.AjaxViewHandler;
import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.context.ContextInitParameters;
import org.ajax4jsf.renderkit.AjaxContainerRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -82,6 +83,8 @@
public static final String APPLICATION_XHTML_XML = "application/xhtml+xml";
+ private boolean handleViewExpiredOnClient=false;
+
public BaseFilter filter;
public void setFilter(BaseFilter filter) {
@@ -107,6 +110,7 @@
getSystemid()));
setNamespace((String) nz(config.getInitParameter(NAMESPACE_PARAMETER),
getNamespace()));
+ handleViewExpiredOnClient =
Boolean.parseBoolean(config.getServletContext().getInitParameter(ContextInitParameters.HANDLE_VIEW_EXPIRED_ON_CLIENT));
}
@@ -151,7 +155,7 @@
} catch (ServletException e) {
log.error("Exception in the filter chain", e);
- if(isViewExpired(e)){
+ if(handleViewExpiredOnClient && isViewExpired(e)){
Writer output = resetResponse(response, servletResponseWrapper, "true");
String message = Messages
.getMessage(Messages.AJAX_VIEW_EXPIRED);