From cdc9bf76a94845dfcf2bdc02058ca5f6f3072e0b Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 15 Jan 2016 17:03:17 +0100 Subject: [PATCH] SessionDisconnectEvent actually preserves given session user Issue: SPR-13871 --- .../socket/messaging/SessionDisconnectEvent.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SessionDisconnectEvent.java b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SessionDisconnectEvent.java index a4167377c4..ba75574014 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SessionDisconnectEvent.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SessionDisconnectEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,15 +53,24 @@ public class SessionDisconnectEvent extends AbstractSubProtocolEvent { this(source, message, sessionId, closeStatus, null); } + /** + * Create a new SessionDisconnectEvent. + * @param source the component that published the event (never {@code null}) + * @param message the message + * @param sessionId the disconnect message + * @param closeStatus the status object + * @param user the current session user + */ public SessionDisconnectEvent(Object source, Message message, String sessionId, CloseStatus closeStatus, Principal user) { - super(source, message); - Assert.notNull(sessionId, "'sessionId' must not be null"); + super(source, message, user); + Assert.notNull(sessionId, "Session id must not be null"); this.sessionId = sessionId; this.status = closeStatus; } + /** * Return the session id. */ @@ -76,6 +85,7 @@ public class SessionDisconnectEvent extends AbstractSubProtocolEvent { return this.status; } + @Override public String toString() { return "SessionDisconnectEvent[sessionId=" + this.sessionId + ", " +