Skip to content

Commit 4fc6ead

Browse files
committed
SessionDisconnectEvent actually preserves given session user
Issue: SPR-13871 (cherry picked from commit cdc9bf7)
1 parent c1f233c commit 4fc6ead

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

spring-websocket/src/main/java/org/springframework/web/socket/messaging/SessionDisconnectEvent.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,15 +53,24 @@ public SessionDisconnectEvent(Object source, Message<byte[]> message, String ses
5353
this(source, message, sessionId, closeStatus, null);
5454
}
5555

56+
/**
57+
* Create a new SessionDisconnectEvent.
58+
* @param source the component that published the event (never {@code null})
59+
* @param message the message
60+
* @param sessionId the disconnect message
61+
* @param closeStatus the status object
62+
* @param user the current session user
63+
*/
5664
public SessionDisconnectEvent(Object source, Message<byte[]> message, String sessionId,
5765
CloseStatus closeStatus, Principal user) {
5866

59-
super(source, message);
60-
Assert.notNull(sessionId, "'sessionId' must not be null");
67+
super(source, message, user);
68+
Assert.notNull(sessionId, "Session id must not be null");
6169
this.sessionId = sessionId;
6270
this.status = closeStatus;
6371
}
6472

73+
6574
/**
6675
* Return the session id.
6776
*/
@@ -76,6 +85,7 @@ public CloseStatus getCloseStatus() {
7685
return this.status;
7786
}
7887

88+
7989
@Override
8090
public String toString() {
8191
return "SessionDisconnectEvent[sessionId=" + this.sessionId + ", " +

0 commit comments

Comments
 (0)