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 void
createSession
(String serverName, org.xmlpull.v1.XmlPullParser xpp, Connection connection) protected void
createSession
(org.xmlpull.v1.XmlPullParser xpp) Uses the XPP to grab the opening stream tag and create an active session object.protected org.dom4j.Document
protected void
initiateSession
(String stanza, XMPPPacketReader reader) protected boolean
isEndOfStream
(String xml) Checks if the provided XML data represents the end / closing of an XMPP stream.protected boolean
isStartOfStream
(String xml) Checks if the provided XML data represents the beginning of a new XMPP stream.protected void
After SASL authentication was successful we should open a new stream and offer new stream features such as resource binding and session establishment.static String
withoutDeclaration
(org.dom4j.Document document) Methods inherited from class org.jivesoftware.openfire.net.ClientStanzaHandler
getNamespace, processIQ, processMessage, processPresence, processUnknowPacket, startTLS, validateHost, validateJIDs
Methods 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:
initiateSession
in classStanzaHandler
- 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 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:
createSession
in classClientStanzaHandler
- Throws:
org.xmlpull.v1.XmlPullParserException
-
getStreamHeader
protected org.dom4j.Document getStreamHeader()- Overrides:
getStreamHeader
in 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:
saslSuccessful
in classStanzaHandler
-
isStartOfStream
Description copied from class:StanzaHandler
Checks if the provided XML data represents the beginning of a new XMPP stream.- Overrides:
isStartOfStream
in 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:StanzaHandler
Checks if the provided XML data represents the end / closing of an XMPP stream.- Overrides:
isEndOfStream
in classStanzaHandler
- Parameters:
xml
- The XML to verify- Returns:
- 'true' if the provided data represents the end of an XMPP stream.
-
withoutDeclaration
-