pessoal quando fico um tempo com a tela parada na aplicação cerca de minutos quando vou executar qualquer ação da o seguinte erro javax.faces.application.ViewExpiredException: viewId:/main.dg - View /main.dg could not be restored.
xml
<welcome-file-list>
<welcome-file>start.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<!--Soluciona o problema da ViewExpiredException ACHEI NA INTERNET MAS NÃO ADIANTA-->
<context-param>
<param-name>com.sun.faces.disableVersionTracking</param-name>
<param-value>true</param-value>
</context-param>
<!--Somente aplicado se o estado saving method seja "server" (= default).
Define o tamnaho (default = 20) das ultimas views serao armazenadas na session.-->
<context-param>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>40</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.dg</url-pattern>
</servlet-mapping>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
faces
<lifecycle>
<phase-listener>br.com.projeto.filter.AuthorizationListener</phase-listener>
</lifecycle>
...
beans e navegações ...
...
...
..
classe de ciclo de vida
public class AuthorizationListener implements PhaseListener {
public void afterPhase(PhaseEvent event) {
FacesContext facesContext = event.getFacesContext();
String currentPage = facesContext.getViewRoot().getViewId();
boolean isLoginPage = (currentPage.lastIndexOf("login.jsp") > -1);
HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);
String currentUser = (String) session.getAttribute("codUsuario");
if (!isLoginPage && (currentUser == null || currentUser.equals(""))) {
NavigationHandler nh = facesContext.getApplication().getNavigationHandler();
nh.handleNavigation(facesContext, null, "loginPage");
} else if (isLoginPage && (currentUser != null && !currentUser.equals(""))) {
NavigationHandler nh = facesContext.getApplication().getNavigationHandler();
nh.handleNavigation(facesContext, null, "openSystem");
}
}
public void beforePhase(PhaseEvent event) {
}
public PhaseId getPhaseId() {
return PhaseId.RESTORE_VIEW;
}
}