Package org.java_websocket.protocols
Class Protocol
- java.lang.Object
-
- org.java_websocket.protocols.Protocol
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.PatternpatternCommaprivate static java.util.regex.PatternpatternSpaceprivate java.lang.StringprovidedProtocolAttribute for the provided protocol
-
Constructor Summary
Constructors Constructor Description Protocol(java.lang.String providedProtocol)Constructor for a Sec-Websocket-Protocol
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptProvidedProtocol(java.lang.String inputProtocolHeader)Check if the received Sec-WebSocket-Protocol header field contains a offer for the specific protocolIProtocolcopyInstance()To prevent protocols to be used more than once the Websocket implementation should call this method in order to create a new usable version of a given protocol instance.booleanequals(java.lang.Object o)java.lang.StringgetProvidedProtocol()Return the specific Sec-WebSocket-protocol header offer for this protocol if the endpoint.inthashCode()java.lang.StringtoString()Return a string which should contain the protocol name as well as additional information about the current configurations for this protocol (DEBUG purposes)
-
-
-
Method Detail
-
acceptProvidedProtocol
public boolean acceptProvidedProtocol(java.lang.String inputProtocolHeader)
Description copied from interface:IProtocolCheck if the received Sec-WebSocket-Protocol header field contains a offer for the specific protocol- Specified by:
acceptProvidedProtocolin interfaceIProtocol- Parameters:
inputProtocolHeader- the received Sec-WebSocket-Protocol header field offered by the other endpoint- Returns:
- true, if the offer does fit to this specific protocol
-
getProvidedProtocol
public java.lang.String getProvidedProtocol()
Description copied from interface:IProtocolReturn the specific Sec-WebSocket-protocol header offer for this protocol if the endpoint. If the extension returns an empty string (""), the offer will not be included in the handshake.- Specified by:
getProvidedProtocolin interfaceIProtocol- Returns:
- the specific Sec-WebSocket-Protocol header for this protocol
-
copyInstance
public IProtocol copyInstance()
Description copied from interface:IProtocolTo prevent protocols to be used more than once the Websocket implementation should call this method in order to create a new usable version of a given protocol instance.- Specified by:
copyInstancein interfaceIProtocol- Returns:
- a copy of the protocol
-
toString
public java.lang.String toString()
Description copied from interface:IProtocolReturn a string which should contain the protocol name as well as additional information about the current configurations for this protocol (DEBUG purposes)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-