Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.7.1 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.net
Class StanzaHandler

    java.lang.Object
      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.
`org.xmpp.packet.JID` | `getAddress()` Obtain the address of the XMPP entity for which this StanzaHandler handles stanzas.
`void` | `process(String stanza, org.dom4j.io.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.

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(org.xmpp.packet.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(org.xmpp.packet.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(org.xmpp.packet.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`

### getAddress

    public org.xmpp.packet.JID getAddress()

  Obtain the address of the XMPP entity for which this StanzaHandler handles stanzas. Note that the value that is returned for this method can change over time. For example, if no session has been established yet, this method will return null, or, if resource binding occurs, the returned value might change. Values obtained from this method are therefore best not cached.

  Returns:
    The address of the XMPP entity for.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.7.1 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.