public abstract class StanzaHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CHARSET
The utf-8 charset for decoding and encoding Jabber packet streams.
|
protected Connection |
connection |
static SystemProperty<Boolean> |
PROPERTY_OVERWRITE_EMPTY_TO |
protected LocalSession |
session
Session associated with the socket reader.
|
| Constructor and Description |
|---|
StanzaHandler(PacketRouter router,
Connection connection)
Creates a dedicated reader for a socket.
|
StanzaHandler(PacketRouter router,
String serverName,
Connection connection)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
createSession(org.xmlpull.v1.XmlPullParser xpp)
Uses the XPP to grab the opening stream tag and create an active session
object.
|
org.xmpp.packet.JID |
getAddress()
Obtain the address of the XMPP entity for which this StanzaHandler
handles stanzas.
|
void |
process(String stanza,
XMPPPacketReader reader) |
protected void |
processIQ(org.xmpp.packet.IQ packet)
Process the received IQ packet.
|
protected void |
processMessage(org.xmpp.packet.Message packet)
Process the received Message packet.
|
protected void |
processPresence(org.xmpp.packet.Presence packet)
Process the received Presence packet.
|
void |
setSession(LocalSession session) |
public static final SystemProperty<Boolean> PROPERTY_OVERWRITE_EMPTY_TO
protected static String CHARSET
protected Connection connection
protected LocalSession session
public StanzaHandler(PacketRouter router, Connection connection)
router - the router for sending packets that were read.connection - the connection being read.@Deprecated public StanzaHandler(PacketRouter router, String serverName, Connection connection)
public void setSession(LocalSession session)
public void process(String stanza, XMPPPacketReader reader) throws Exception
Exceptionprotected void processIQ(org.xmpp.packet.IQ packet)
throws UnauthorizedException
PacketInterceptor will 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.
packet - the received packet.UnauthorizedException - if service is not available to sender.protected void processPresence(org.xmpp.packet.Presence packet)
throws UnauthorizedException
PacketInterceptor will 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.
packet - the received packet.UnauthorizedException - if service is not available to sender.protected void processMessage(org.xmpp.packet.Message packet)
throws UnauthorizedException
PacketInterceptor will 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.
packet - the received packet.UnauthorizedException - if service is not available to sender.protected void createSession(org.xmlpull.v1.XmlPullParser xpp)
throws org.xmlpull.v1.XmlPullParserException,
IOException
xpp - the pull parserorg.xmlpull.v1.XmlPullParserException - if an exception occurs reading from the pull parserIOException - if an IO exception occurs reading from the pull parserpublic org.xmpp.packet.JID getAddress()
null, or, if resource binding occurs,
the returned value might change. Values obtained from this method are
therefore best not cached.Copyright © 2003–2020 Ignite Realtime. All rights reserved.