@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2017 the original author or authors .
* Copyright 2002 - 2018 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 .
@ -60,6 +60,7 @@ import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSe
@@ -60,6 +60,7 @@ import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSe
* sub - protocol handler to send messages from the application back to the client .
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @author Andy Wilkinson
* @author Artem Bilan
* @since 4 . 0
@ -152,8 +153,8 @@ public class SubProtocolWebSocketHandler
@@ -152,8 +153,8 @@ public class SubProtocolWebSocketHandler
for ( String protocol : protocols ) {
SubProtocolHandler replaced = this . protocolHandlerLookup . put ( protocol , handler ) ;
if ( replaced ! = null & & replaced ! = handler ) {
throw new IllegalStateException ( "Can' t map " + handler +
" to protocol '" + protocol + "'. A lready mapped to " + replaced + "." ) ;
throw new IllegalStateException ( "Canno t map " + handler +
" to protocol '" + protocol + "': a lready mapped to " + replaced + "." ) ;
}
}
this . protocolHandlers . add ( handler ) ;
@ -260,8 +261,8 @@ public class SubProtocolWebSocketHandler
@@ -260,8 +261,8 @@ public class SubProtocolWebSocketHandler
holder . getSession ( ) . close ( CloseStatus . GOING_AWAY ) ;
}
catch ( Throwable ex ) {
if ( logger . isError Enabled ( ) ) {
logger . error ( "Failed to close '" + holder . getSession ( ) + "': " + ex ) ;
if ( logger . isWarn Enabled ( ) ) {
logger . warn ( "Failed to close '" + holder . getSession ( ) + "': " + ex ) ;
}
}
}
@ -321,7 +322,7 @@ public class SubProtocolWebSocketHandler
@@ -321,7 +322,7 @@ public class SubProtocolWebSocketHandler
String sessionId = resolveSessionId ( message ) ;
if ( sessionId = = null ) {
if ( logger . isErrorEnabled ( ) ) {
logger . error ( "Couldn' t find session id in " + message ) ;
logger . error ( "Could no t find session id in " + message ) ;
}
return ;
}
@ -400,8 +401,8 @@ public class SubProtocolWebSocketHandler
@@ -400,8 +401,8 @@ public class SubProtocolWebSocketHandler
}
catch ( Exception ex ) {
// Shouldn't happen
logger . error ( "Failed to obtain session.getAcceptedProtocol(). " +
"W ill use the default protocol handler (if configured)." , ex ) ;
logger . error ( "Failed to obtain session.getAcceptedProtocol(): " +
"w ill use the default protocol handler (if configured)." , ex ) ;
}
SubProtocolHandler handler ;
@ -469,8 +470,8 @@ public class SubProtocolWebSocketHandler
@@ -469,8 +470,8 @@ public class SubProtocolWebSocketHandler
continue ;
}
WebSocketSession session = holder . getSession ( ) ;
if ( logger . isError Enabled ( ) ) {
logger . error ( "No messages received after " + timeSinceCreated + " ms. " +
if ( logger . isInfo Enabled ( ) ) {
logger . info ( "No messages received after " + timeSinceCreated + " ms. " +
"Closing " + holder . getSession ( ) + "." ) ;
}
try {
@ -478,8 +479,8 @@ public class SubProtocolWebSocketHandler
@@ -478,8 +479,8 @@ public class SubProtocolWebSocketHandler
session . close ( CloseStatus . SESSION_NOT_RELIABLE ) ;
}
catch ( Throwable ex ) {
if ( logger . isError Enabled ( ) ) {
logger . error ( "Failure while closing " + session , ex ) ;
if ( logger . isWarn Enabled ( ) ) {
logger . warn ( "Failed to close unreliable " + session , ex ) ;
}
}
}