[#1374] Allow users to all all subprotocols by using * as wildcard

This commit is contained in:
Norman Maurer 2013-05-17 21:57:47 +02:00
parent abb4e20d0b
commit 8a5e249d6f

View File

@ -55,6 +55,11 @@ public abstract class WebSocketServerHandshaker {
private String selectedSubprotocol;
/**
* Use this as wildcard to support all requested sub-protocols
*/
public final static String SUB_PROTOCOL_WILDCARD = "*";
/**
* Constructor specifying the destination web socket location
*
@ -232,7 +237,8 @@ public abstract class WebSocketServerHandshaker {
String requestedSubprotocol = p.trim();
for (String supportedSubprotocol: subprotocols) {
if (requestedSubprotocol.equals(supportedSubprotocol)) {
if (SUB_PROTOCOL_WILDCARD.equals(supportedSubprotocol)
|| requestedSubprotocol.equals(supportedSubprotocol)) {
return requestedSubprotocol;
}
}