I updated the PrimeFaces version to 6.2. Everything went good, except for an issue with CDI conversations management.
After the update, it seems like the conversation is initialized at the first access to a page, but it is lost just before the first call to the controller. In fact, when accessing to a page a new conversation is been initialized (and this is correct). But after the first call to a controller method a new conversation is initialized, losing the previous one and all its parameter values. The following calls maintain the last conversation as usual.
With PrimeFaces 6.1 (and previous) this never happened.
Is this a bug or a lack of mine?
After the access to the page, the text displayed is "Init value with conversation id = 1".
By clicking the button, the displayed text changes to "Value set with conversation id = 2".
The following clicks mantain the cid = 2.
Controller
@Named
@ConversationScoped
@LoggedIn
public class TestController implements Serializable {
static final long serialVersionUID = 69823746898775L;
@Inject protected Conversation conversation;
@Inject protected FacesContext facesContext;
rivate String outputValue;
@PostConstruct
public void init() throws IOException {
if (conversation.isTransient()) {
conversation.begin();
conversation.setTimeout(1800000);
}
outputValue = "Init value with conversation id = " + conversation.getId();
}
public void handleCall() {
outputValue = "Value set with conversation id = " + conversation.getId();
}
public String getOutputValue() {
return outputValue;
}
public void setOutputValue(String outputValue) {
this.outputValue = outputValue;
}
}
JSF page
<?xml version="1.0" encoding="UTF-8"?>
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui" contentType="text/html">
<html>
<h:head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" type='image/x-icon' href='favicon.ico'/>
<ui:insert name="head" />
</h:head>
<h:body onload="javascript: if ('#{param.sessionExpired}'.length != 0) PF('loginDialog').show()">
<h:form id="testForm">
<p:commandButton action="#{testController.handleCall()}" value="Make a call" update="@form" />
<h:outputText value="#{testController.outputValue}" />
</h:form>
</h:body>
</html>
</f:view>