Package org.simpleframework.http.socket
Class Reason
java.lang.Object
org.simpleframework.http.socket.Reason
The
Reason
object is used to hold a textual reason
for connection closure and an RFC 6455 defined code. When a
connection is to be closed a control frame with an opcode of
close is sent with the text reason, if one is provided.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
code
This is the close code to be sent with a control frame. -
text
This is the textual description of the close reason.
-
-
Constructor Details
-
Reason
Constructor for theReason
object. This is used to create a reason and a textual description of that reason to be delivered as a control frame.- Parameters:
code
- this is the code to be sent with the frame
-
Reason
Constructor for theReason
object. This is used to create a reason and a textual description of that reason to be delivered as a control frame.- Parameters:
code
- this is the code to be sent with the frametext
- this is textual description of the close reason
-
-
Method Details
-
getCode
This is used to get the RFC 6455 code describing the type of close event. It is the code that should be used by applications to determine why the connection was terminated.- Returns:
- returns the close code for the connection
-
getText
This is used to get the textual description for the closure. In many scenarios there will be no textual reason as it is an optional attribute.- Returns:
- this returns the description for the closure
-
toString
This is used to provide a textual representation of the reason. For consistency this will only return the enumerated value for the close code, or if none exists a "null" text string.
-