Class OpeningHandshakeException

  • All Implemented Interfaces:
    java.io.Serializable

    public class OpeningHandshakeException
    extends WebSocketException
    An exception raised due to a violation against the WebSocket protocol.
    Since:
    1.19
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBody()
      Get the response body contained in the WebSocket opening handshake response from the server.
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaders()
      Get the HTTP headers contained in the WebSocket opening handshake response from the server.
      StatusLine getStatusLine()
      Get the status line contained in the WebSocket opening handshake response from the server.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • mStatusLine

        private final StatusLine mStatusLine
      • mHeaders

        private final java.util.Map<java.lang.String,​java.util.List<java.lang.String>> mHeaders
      • mBody

        private final byte[] mBody
    • Constructor Detail

      • OpeningHandshakeException

        OpeningHandshakeException​(WebSocketError error,
                                  java.lang.String message,
                                  StatusLine statusLine,
                                  java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers)
      • OpeningHandshakeException

        OpeningHandshakeException​(WebSocketError error,
                                  java.lang.String message,
                                  StatusLine statusLine,
                                  java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers,
                                  byte[] body)
    • Method Detail

      • getStatusLine

        public StatusLine getStatusLine()
        Get the status line contained in the WebSocket opening handshake response from the server.
        Returns:
        The status line.
      • getHeaders

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaders()
        Get the HTTP headers contained in the WebSocket opening handshake response from the server.
        Returns:
        The HTTP headers. The returned map is an instance of TreeMap with String.CASE_INSENSITIVE_ORDER comparator.
      • getBody

        public byte[] getBody()
        Get the response body contained in the WebSocket opening handshake response from the server.

        This method returns a non-null value only when (1) the status code is not 101 (Switching Protocols), (2) the response from the server has a response body, (3) the response has "Content-Length" header, and (4) no error occurred during reading the response body. In other cases, this method returns null.

        Returns:
        The response body.