myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Gonzalez <adr_gonza...@yahoo.fr>
Subject CODI ViewAccessScoped destroyed on GET request
Date Tue, 04 Dec 2012 10:32:13 GMT
Hello,

I just began using @ViewAccessScoped.
Problem is that my bean is removed on some GET requests (h:link) - even if I'm always displaying
the same page using this viewAccessScoped bean.

Environment :
 * CODI 1.0.5
 * JBoss 7.1.0.Final

My page (test.xhtml) uses a single @ViewAccessScoped bean.

In my page I have :
 * a h:link pointing to test.xhtml
 * h:commandButton just doing a simple postback (no action, no navigation rule).

When I do :
 1. http://myhost/myapp/test.xhtml
 2. click on h:commandButton
 3. click on h:link

Everything works fine.

When I do :
 1. http://myhost/myapp/test.xhtml
 2. click on h:link
@PreDestroy and @PostConstruct are called in phase 6 of step 2 (the bean is removed and recreated).


Is this a bug or did I miss sthing ?

Thanks for the help !

P.S. 
here's my sample :
To reproduce failed testcase, just :
 1. http://myhost/myapp/test.xhtml on your browser
 2. click on first link '1.GET - windowId propagation'

jsf page 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en"
    xmlns="http://www.w3.org/1999/xhtml";
    xmlns:f="http://java.sun.com/jsf/core";
    xmlns:h="http://java.sun.com/jsf/html";
    xmlns:ui="http://java.sun.com/jsf/facelets";>
    <h:head/>
    <h:body>
    #{pingController.value}
    <h:messages globalOnly="true"/>
    <p>windowId=#{currentWindow.id}</p>
    <ol>
      <li><h:link outcome="test.xhtml" value="GET - windowId propagation"/></li>
       <li>
         <h:link outcome="test.xhtml" value="GET - no propagation">
           <f:param name="windowId" value=""/>
       </h:link>
       </li>
       <li><a href="#{facesContext.externalContext.request.contextPath}/test.xhtml?windowId=#{currentWindow.id}">GET
- windowId propagation with a href</a></li>
       <li>
         <h:form>
           <h:commandButton value="POST"/> POST - windowId propagation
         </h:form>
       </li>
     </ol>
  </h:body>
</html>

ViewAccess bean :
@Named
@ViewAccessScoped
@SuppressWarnings("serial")
public class PingController implements Serializable {

private String value;
@PostConstruct
public void initialize() {
System.out.println("@PostConstruct");
Messages.addGlobalInfo("@PostConstruct");
}

@PreDestroy
public void destroy() {
System.out.println("@PreDestroy");
Messages.addGlobalInfo("@PreDestroy");
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}
}

Mime
View raw message