[jboss-jira] [JBoss JIRA] (WFLY-7280) getSession() Always Creating HttpSession Problem
kin zhu (JIRA)
issues at jboss.org
Mon Oct 10 05:39:00 EDT 2016
kin zhu created WFLY-7280:
-----------------------------
Summary: getSession() Always Creating HttpSession Problem
Key: WFLY-7280
URL: https://issues.jboss.org/browse/WFLY-7280
Project: WildFly
Issue Type: Bug
Components: Web (Undertow)
Affects Versions: 10.1.0.Final
Environment: jdk8u102, win7x64, wildfly-servlet-10.1.0.Final.tar.gz
Reporter: kin zhu
Assignee: Stuart Douglas
I have a login application called cas.war. I store the captcha code in session. This application has been running smoothly in JBoss7 and Tomcat7. But when I tried to migrate to wildfly10, I found the captcha code will always be null. I dug a little deeper, and found out that the server is creating new session each time I post a request(the JSESSIONID cookie changes on every request). I traced the code and pinned down the problem on this location (as of undertow-servlet-1.4.0.Final-sources.jar ) :
{color:#f6c342}io.undertow.servlet.spec.ServletContextImpl.java, method getSession:{color}
{code:java}
public HttpSessionImpl getSession(final ServletContextImpl originalServletContext, final HttpServerExchange exchange, boolean create) {
SessionConfig c = originalServletContext.getSessionConfig();
HttpSessionImpl httpSession = exchange.getAttachment(sessionAttachmentKey);
{code}
while
sessionAttachmentKey = {color:#f6c342}io.undertow.util.SimpleAttachmentKey<io.undertow.servlet.spec.HttpSessionImpl>{color}
the exchange.attachments map will only contain one such key: {color:#f6c342}io.undertow.util.SimpleAttachmentKey<io.undertow.server.session.InMemorySessionManager$SessionImpl>{color}
thus the server will create new session once request.getSession() is called, regardless one session exist or not.
And please have a look at the relate class InMemorySessionManager too.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list