Class WebSocketClientStanzaHandler


public class WebSocketClientStanzaHandler extends ClientStanzaHandler
A StanzaHandler that is able to process the specific framing that is used by clients connecting via websockets.
Author:
Guus der Kinderen, guus@goodbytes.nl
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • initiateSession

      protected void initiateSession(String stanza, XMPPPacketReader reader) throws Exception
      Overrides:
      initiateSession in class StanzaHandler
      Throws:
      Exception
    • createSession

      protected void createSession(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException
      Description copied from class: StanzaHandler
      Uses the XPP to grab the opening stream tag and create an active session object. The session to create will depend on the sent namespace. In all cases, the method obtains the opening stream tag, checks for errors, and either creates a session or returns an error and kills the connection. If the connection remains open, the XPP will be set to be ready for the first packet. A call to next() should result in an START_TAG state with the first packet in the stream.
      Overrides:
      createSession in class StanzaHandler
      Parameters:
      xpp - the pull parser
      Throws:
      org.xmlpull.v1.XmlPullParserException - if an exception occurs reading from the pull parser
      IOException - if an IO exception occurs reading from the pull parser
    • createSession

      protected void createSession(String serverName, org.xmlpull.v1.XmlPullParser xpp, Connection connection) throws org.xmlpull.v1.XmlPullParserException
      Overrides:
      createSession in class ClientStanzaHandler
      Throws:
      org.xmlpull.v1.XmlPullParserException
    • getStreamHeader

      protected org.dom4j.Document getStreamHeader()
      Overrides:
      getStreamHeader in class StanzaHandler
    • saslSuccessful

      protected void saslSuccessful()
      After SASL authentication was successful we should open a new stream and offer new stream features such as resource binding and session establishment. Notice that resource binding and session establishment should only be offered to clients (i.e. not to servers or external components)
      Overrides:
      saslSuccessful in class StanzaHandler
    • isStartOfStream

      protected boolean isStartOfStream(String xml)
      Description copied from class: StanzaHandler
      Checks if the provided XML data represents the beginning of a new XMPP stream.
      Overrides:
      isStartOfStream in class StanzaHandler
      Parameters:
      xml - The XML to verify
      Returns:
      'true' if the provided data represents the beginning of an XMPP stream.
    • isEndOfStream

      protected boolean isEndOfStream(String xml)
      Description copied from class: StanzaHandler
      Checks if the provided XML data represents the end / closing of an XMPP stream.
      Overrides:
      isEndOfStream in class StanzaHandler
      Parameters:
      xml - The XML to verify
      Returns:
      'true' if the provided data represents the end of an XMPP stream.
    • withoutDeclaration

      public static String withoutDeclaration(org.dom4j.Document document)