|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
* Copyright 2002-2024 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -23,6 +23,7 @@ import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
@ -154,7 +155,7 @@ public abstract class AbstractHandshakeHandler implements HandshakeHandler, Life |
|
|
|
public void setSupportedProtocols(String... protocols) { |
|
|
|
public void setSupportedProtocols(String... protocols) { |
|
|
|
this.supportedProtocols.clear(); |
|
|
|
this.supportedProtocols.clear(); |
|
|
|
for (String protocol : protocols) { |
|
|
|
for (String protocol : protocols) { |
|
|
|
this.supportedProtocols.add(protocol.toLowerCase()); |
|
|
|
this.supportedProtocols.add(protocol.toLowerCase(Locale.ROOT)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -329,10 +330,10 @@ public abstract class AbstractHandshakeHandler implements HandshakeHandler, Life |
|
|
|
protected String selectProtocol(List<String> requestedProtocols, WebSocketHandler webSocketHandler) { |
|
|
|
protected String selectProtocol(List<String> requestedProtocols, WebSocketHandler webSocketHandler) { |
|
|
|
List<String> handlerProtocols = determineHandlerSupportedProtocols(webSocketHandler); |
|
|
|
List<String> handlerProtocols = determineHandlerSupportedProtocols(webSocketHandler); |
|
|
|
for (String protocol : requestedProtocols) { |
|
|
|
for (String protocol : requestedProtocols) { |
|
|
|
if (handlerProtocols.contains(protocol.toLowerCase())) { |
|
|
|
if (handlerProtocols.contains(protocol.toLowerCase(Locale.ROOT))) { |
|
|
|
return protocol; |
|
|
|
return protocol; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.supportedProtocols.contains(protocol.toLowerCase())) { |
|
|
|
if (this.supportedProtocols.contains(protocol.toLowerCase(Locale.ROOT))) { |
|
|
|
return protocol; |
|
|
|
return protocol; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|