com.caucho.hmtp
Class Packet

java.lang.Object
  extended by com.caucho.hmtp.Packet
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Message, MessageError, Presence, QueryError, QueryGet, QueryResult, QuerySet

public class Packet
extends java.lang.Object
implements java.io.Serializable

Base packet class. Contains only a 'to' and a 'from' field.

See Also:
Serialized Form

Constructor Summary
protected Packet()
          null constructor for Hessian deserialization
  Packet(java.lang.String to)
          Creates a packet with a destination, but no source, e.g.
  Packet(java.lang.String to, java.lang.String from)
          Creates a packet with a destination and a source.
 
Method Summary
 void dispatch(BamStream handler, BamStream toSource)
          SPI method to dispatch the packet to the proper handler
 java.lang.String getFrom()
          Returns the 'from' field
 java.lang.String getTo()
          Returns the 'to' field
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Packet

protected Packet()
null constructor for Hessian deserialization


Packet

public Packet(java.lang.String to)
Creates a packet with a destination, but no source, e.g. from a client. The server will infer the source from the hmpp session binding.

Parameters:
to - the destination jid

Packet

public Packet(java.lang.String to,
              java.lang.String from)
Creates a packet with a destination and a source.

Parameters:
to - the destination jid
from - the source jid
Method Detail

getTo

public java.lang.String getTo()
Returns the 'to' field


getFrom

public java.lang.String getFrom()
Returns the 'from' field


dispatch

public void dispatch(BamStream handler,
                     BamStream toSource)
SPI method to dispatch the packet to the proper handler


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object