Openfire 3.5.2 Javadoc

org.jivesoftware.openfire.net
Class StanzaHandler

java.lang.Object
  extended by org.jivesoftware.openfire.net.StanzaHandler
Direct Known Subclasses:
ClientStanzaHandler, ComponentStanzaHandler, MultiplexerStanzaHandler, ServerStanzaHandler

public abstract class StanzaHandler
extends Object

A StanzaHandler is the main responsible for handling incoming stanzas. Some stanzas like startTLS are totally managed by this class. The rest of the stanzas are just forwarded to the router.

Author:
Gaston Dombiak

Field Summary
protected static String CHARSET
          The utf-8 charset for decoding and encoding Jabber packet streams.
protected  Connection connection
           
protected  String serverName
          Server name for which we are attending clients.
protected  LocalSession session
          Session associated with the socket reader.
 
Constructor Summary
StanzaHandler(PacketRouter router, String serverName, Connection connection)
          Creates a dedicated reader for a socket.
 
Method Summary
protected  void createSession(org.xmlpull.v1.XmlPullParser xpp)
          Uses the XPP to grab the opening stream tag and create an active session object.
 void process(String stanza, org.dom4j.io.XMPPPacketReader reader)
           
protected  void processIQ(IQ packet)
          Process the received IQ packet.
protected  void processMessage(Message packet)
          Process the received Message packet.
protected  void processPresence(Presence packet)
          Process the received Presence packet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARSET

protected static String CHARSET
The utf-8 charset for decoding and encoding Jabber packet streams.


connection

protected Connection connection

session

protected LocalSession session
Session associated with the socket reader.


serverName

protected String serverName
Server name for which we are attending clients.

Constructor Detail

StanzaHandler

public StanzaHandler(PacketRouter router,
                     String serverName,
                     Connection connection)
Creates a dedicated reader for a socket.

Parameters:
router - the router for sending packets that were read.
serverName - the name of the server this socket is working for.
connection - the connection being read.
Method Detail

process

public void process(String stanza,
                    org.dom4j.io.XMPPPacketReader reader)
             throws Exception
Throws:
Exception

processIQ

protected void processIQ(IQ packet)
                  throws UnauthorizedException
Process the received IQ packet. Registered 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.

Parameters:
packet - the received packet.
Throws:
UnauthorizedException - if service is not available to sender.

processPresence

protected void processPresence(Presence packet)
                        throws UnauthorizedException
Process the received Presence packet. Registered 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.

Parameters:
packet - the received packet.
Throws:
UnauthorizedException - if service is not available to sender.

processMessage

protected void processMessage(Message packet)
                       throws UnauthorizedException
Process the received Message packet. Registered 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.

Parameters:
packet - the received packet.
Throws:
UnauthorizedException - if service is not available to sender.

createSession

protected void createSession(org.xmlpull.v1.XmlPullParser xpp)
                      throws org.xmlpull.v1.XmlPullParserException,
                             IOException
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.

Throws:
org.xmlpull.v1.XmlPullParserException
IOException

Openfire 3.5.2 Javadoc

Copyright © 2003-2007 Jive Software.