New HttpSession gets created on each request
tnabeel Aug 10, 2008 11:28 AMNew HttpSession gets created on each request
I couldn't get access to the same scoped Seam-component work across requests. Just realized that a new HttpSession is created on each request.
It makes no difference if I use <s:link> instead of <h:commandLink>
I'm using portletbridge-impl-1.0.0.B3 / JBoss Portal 2.6.6.GA / Seam 2.0.2.SP1 / RichFaces 3.2.1
Below is a test case that duplicates the issue. I would really appreciate help at this point. The test case below works as expected on JBoss 4.2.2.GA.
test.xhtml:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:s="http://jboss.com/products/seam/taglib">
<h:form>
<h:commandLink action="/page/test.xhtml" styleClass="menuLink">Main</h:commandLink>
<h:outputText value="#{testBean.value}"></h:outputText>
</h:form>
</ui:composition>
TestBean.java:
import javax.faces.context.FacesContext;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;
@Name("testBean")
public class TestBean {
@Logger
private Log log;
private String value;
public String getValue() {
log.info("************SESSION ID="+FacesContext.getCurrentInstance().getExternalContext().getSession(false).hashCode());
return value;
}
public void setValue(String value) {
this.value = value;
}
}
On JBoss Portal 2.6.6.GA, different session is created on each request:
11:13:45,734 INFO [TestBean] ************SESSION ID=15014154
11:13:49,312 INFO [TestBean] ************SESSION ID=11898309
11:13:57,703 INFO [TestBean] ************SESSION ID=32604882
11:14:01,578 INFO [TestBean] ************SESSION ID=7738878
11:14:04,765 INFO [TestBean] ************SESSION ID=22343475
11:14:09,187 INFO [TestBean] ************SESSION ID=742190
On JBoss 4.2.2.GA, same session is returned on subsequent requests:
11:22:00,343 INFO [TestBean] ************SESSION ID=15287424
11:22:04,375 INFO [TestBean] ************SESSION ID=15287424
11:22:05,718 INFO [TestBean] ************SESSION ID=15287424
11:22:07,953 INFO [TestBean] ************SESSION ID=15287424
11:22:11,843 INFO [TestBean] ************SESSION ID=15287424
Again, I would really appreciate if someone could tell me if this is a bug or I'm doing something wrong.
Thanks in advance.
-Tareq