Class WebSocketClientStanzaHandler
java.lang.Object
org.jivesoftware.openfire.net.StanzaHandler
org.jivesoftware.openfire.net.ClientStanzaHandler
org.jivesoftware.openfire.websocket.WebSocketClientStanzaHandler
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 Summary
FieldsFields inherited from class org.jivesoftware.openfire.net.StanzaHandler
connection, PROPERTY_OVERWRITE_EMPTY_TO, router, saslStatus, session, sessionCreated, startedSASL, startedTLS, waitingCompressionACK -
Constructor Summary
ConstructorsConstructorDescriptionWebSocketClientStanzaHandler(PacketRouter router, WebSocketConnection connection) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateSession(String serverName, org.xmlpull.v1.XmlPullParser xpp, Connection connection) protected voidcreateSession(org.xmlpull.v1.XmlPullParser xpp) Uses the XPP to grab the opening stream tag and create an active session object.protected org.dom4j.Documentprotected voidinitiateSession(String stanza, XMPPPacketReader reader) protected booleanisEndOfStream(String xml) Checks if the provided XML data represents the end / closing of an XMPP stream.protected booleanisStartOfStream(String xml) Checks if the provided XML data represents the beginning of a new XMPP stream.protected voidAfter SASL authentication was successful we should open a new stream and offer new stream features such as resource binding and session establishment.static StringwithoutDeclaration(org.dom4j.Document document) Methods inherited from class org.jivesoftware.openfire.net.ClientStanzaHandler
getNamespace, processIQ, processMessage, processPresence, processUnknowPacket, startTLS, validateHost, validateJIDsMethods inherited from class org.jivesoftware.openfire.net.StanzaHandler
closeNeverEncryptedConnection, compressClient, compressionSuccessful, getAddress, isHostUnknown, isStreamManagementStanza, negotiateTLS, process, processStanza, setSession, tlsNegotiated
-
Field Details
-
STREAM_HEADER
- See Also:
-
STREAM_FOOTER
- See Also:
-
FRAMING_NAMESPACE
- See Also:
-
-
Constructor Details
-
WebSocketClientStanzaHandler
-
-
Method Details
-
initiateSession
- Overrides:
initiateSessionin classStanzaHandler- Throws:
Exception
-
createSession
protected void createSession(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException Description copied from class:StanzaHandlerUses 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:
createSessionin classStanzaHandler- Parameters:
xpp- the pull parser- Throws:
org.xmlpull.v1.XmlPullParserException- if an exception occurs reading from the pull parserIOException- 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:
createSessionin classClientStanzaHandler- Throws:
org.xmlpull.v1.XmlPullParserException
-
getStreamHeader
protected org.dom4j.Document getStreamHeader()- Overrides:
getStreamHeaderin classStanzaHandler
-
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:
saslSuccessfulin classStanzaHandler
-
isStartOfStream
Description copied from class:StanzaHandlerChecks if the provided XML data represents the beginning of a new XMPP stream.- Overrides:
isStartOfStreamin classStanzaHandler- Parameters:
xml- The XML to verify- Returns:
- 'true' if the provided data represents the beginning of an XMPP stream.
-
isEndOfStream
Description copied from class:StanzaHandlerChecks if the provided XML data represents the end / closing of an XMPP stream.- Overrides:
isEndOfStreamin classStanzaHandler- Parameters:
xml- The XML to verify- Returns:
- 'true' if the provided data represents the end of an XMPP stream.
-
withoutDeclaration
-