Class ClientStanzaHandler
- java.lang.Object
-
- org.jivesoftware.openfire.net.StanzaHandler
-
- org.jivesoftware.openfire.net.ClientStanzaHandler
-
- Direct Known Subclasses:
WebSocketClientStanzaHandler
public class ClientStanzaHandler extends StanzaHandler
Handler of XML stanzas sent by clients connected directly to the server. Received packet will have their FROM attribute overridden to avoid spoofing.By default, the hostname specified in the stream header sent by clients will not be validated. When validated the TO attribute of the stream header has to match the server name or a valid subdomain. If the value of the 'to' attribute is not valid then a host-unknown error will be returned. To enable the validation set the system property xmpp.client.validate.host to true.
- Author:
- Gaston Dombiak
-
-
Field Summary
-
Fields inherited from class org.jivesoftware.openfire.net.StanzaHandler
CHARSET, connection, PROPERTY_OVERWRITE_EMPTY_TO, router, saslStatus, session, sessionCreated, startedSASL, waitingCompressionACK
-
-
Constructor Summary
Constructors Constructor Description ClientStanzaHandler(PacketRouter router, Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcreateSession(String serverName, org.xmlpull.v1.XmlPullParser xpp, Connection connection)protected StringgetNamespace()protected voidprocessIQ(org.xmpp.packet.IQ packet)Process the received IQ packet.protected voidprocessMessage(org.xmpp.packet.Message packet)Process the received Message packet.protected voidprocessPresence(org.xmpp.packet.Presence packet)Process the received Presence packet.protected booleanprocessUnknowPacket(org.dom4j.Element doc)Only packets of type Message, Presence and IQ can be processed by this class.protected voidstartTLS()protected booleanvalidateHost()protected booleanvalidateJIDs()-
Methods inherited from class org.jivesoftware.openfire.net.StanzaHandler
closeNeverEncryptedConnection, closeNeverSecuredConnection, compressClient, compressionSuccessful, createSession, getAddress, getStreamHeader, initiateSession, isEndOfStream, isHostUnknown, isStartOfStream, isStreamManagementStanza, negotiateTLS, process, processStanza, saslSuccessful, setSession, tlsNegotiated
-
-
-
-
Constructor Detail
-
ClientStanzaHandler
public ClientStanzaHandler(PacketRouter router, Connection connection)
-
-
Method Detail
-
processUnknowPacket
protected boolean processUnknowPacket(org.dom4j.Element doc)
Only packets of type Message, Presence and IQ can be processed by this class. Any other type of packet is unknown and thus rejected generating the connection to be closed.- Parameters:
doc- the unknown DOM element that was received- Returns:
- always false.
-
getNamespace
protected String getNamespace()
-
validateHost
protected boolean validateHost()
-
validateJIDs
protected boolean validateJIDs()
-
createSession
protected void createSession(String serverName, org.xmlpull.v1.XmlPullParser xpp, Connection connection) throws org.xmlpull.v1.XmlPullParserException
- Throws:
org.xmlpull.v1.XmlPullParserException
-
processIQ
protected void processIQ(org.xmpp.packet.IQ packet) throws UnauthorizedExceptionDescription copied from class:StanzaHandlerProcess the received IQ packet. RegisteredPacketInterceptorwill be invoked before and after the packet was routed.Subclasses may redefine this method for different reasons such as modifying the sender of the packet to avoid spoofing, rejecting the packet or even process the packet in another thread.
- Overrides:
processIQin classStanzaHandler- Parameters:
packet- the received packet.- Throws:
UnauthorizedException- if service is not available to sender.
-
processPresence
protected void processPresence(org.xmpp.packet.Presence packet) throws UnauthorizedExceptionDescription copied from class:StanzaHandlerProcess the received Presence packet. RegisteredPacketInterceptorwill be invoked before and after the packet was routed.Subclasses may redefine this method for different reasons such as modifying the sender of the packet to avoid spoofing, rejecting the packet or even process the packet in another thread.
- Overrides:
processPresencein classStanzaHandler- Parameters:
packet- the received packet.- Throws:
UnauthorizedException- if service is not available to sender.
-
processMessage
protected void processMessage(org.xmpp.packet.Message packet) throws UnauthorizedExceptionDescription copied from class:StanzaHandlerProcess the received Message packet. RegisteredPacketInterceptorwill be invoked before and after the packet was routed.Subclasses may redefine this method for different reasons such as modifying the sender of the packet to avoid spoofing, rejecting the packet or even process the packet in another thread.
- Overrides:
processMessagein classStanzaHandler- Parameters:
packet- the received packet.- Throws:
UnauthorizedException- if service is not available to sender.
-
-