Browse Source

Throw exception when trying to invalidate FakeHttpSession

The FakeHttpSession is used only for Tomcat 7 as far as I can see (#11721)
Invalidating the fake session will not invalidate the real session so
the end result will not be what the user expects, therefore we throw an
exception instead in this case.

Change-Id: I1703644736d81ee2870b709517cbe5fa523d00f7
tags/7.2.0.beta1
Artur Signell 10 years ago
parent
commit
91b40555d6
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      server/src/com/vaadin/server/WrappedHttpSession.java

+ 14
- 0
server/src/com/vaadin/server/WrappedHttpSession.java View File

@@ -85,6 +85,20 @@ public class WrappedHttpSession implements WrappedSession {

@Override
public void invalidate() {
if (session == null) {
throw new IllegalStateException(
"Session is null and cannot be invalidated");
}

if (session.getClass().getName()
.equals("org.atmosphere.util.FakeHttpSession")) {
throw new UnsupportedOperationException(
"FakeHttpSession cannot be invalidated. "
+ "This typically means you are using websockets together with Tomcat 7. "
+ "Because Tomcat 7 does not support sharing the HTTP session between standard HTTP requests and websockets, a copy of the session is used for websockets. "
+ "Invalidating this session does not have the desired effect. "
+ "To resolve this, upgrade to Tomcat 8 or use another transport mechanism than websockets.");
}
session.invalidate();
}


Loading…
Cancel
Save