Class ResumeRequest

java.lang.Object
org.jivesoftware.openfire.streammanagement.ResumeRequest

public final class ResumeRequest extends Object
Represents a XEP-0198 stream resumption request: the data carried by a <resume/> element. This is used by both variants of stream resumption defined by XEP-0198:
  • the traditional flow, in which the client sends a top-level <resume/> element after having established a stream (see § 5, "Resumption"); and
  • the inline flow, in which the <resume/> element is instead nested inside a SASL2 (XEP-0388) <authenticate/> element (see § 9.2, "Inline Stream Resumption").
Either way, the element takes the same shape:

 <resume xmlns='urn:xmpp:sm:3' h='some-sequence-number' previd='some-long-sm-id'/>
 
  • Method Summary

    Modifier and Type
    Method
    Description
    from(org.dom4j.Element resumeElement)
    Parses a (traditional, top-level) XEP-0198 <resume/> element.
    fromSasl2Authenticate(org.dom4j.Element authenticateElement)
    Parses the inline XEP-0198 <resume/> content of a SASL2 <authenticate/> element.
    long
    Returns the sequence number of the last stanza that the client received from the server over the former stream.
    Returns the Stream Management namespace that the client used for this request.
    Returns the SM-ID of the former stream that the client wishes to resume.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • from

      @Nonnull public static ResumeRequest from(@Nonnull org.dom4j.Element resumeElement) throws MalformedResumeRequestException
      Parses a (traditional, top-level) XEP-0198 <resume/> element.
      Parameters:
      resumeElement - the <resume/> element (cannot be null).
      Returns:
      the parsed request (never null).
      Throws:
      MalformedResumeRequestException - if the element is malformed.
    • fromSasl2Authenticate

      @Nullable public static ResumeRequest fromSasl2Authenticate(@Nonnull org.dom4j.Element authenticateElement) throws MalformedResumeRequestException
      Parses the inline XEP-0198 <resume/> content of a SASL2 <authenticate/> element. Returns null when the element carries no <resume/> child (in a namespace recognized as a Stream Management namespace), in which case there is nothing for the caller to act on.
      Parameters:
      authenticateElement - the <authenticate/> element (cannot be null).
      Returns:
      the parsed request, or null if the element carries no inline resume request.
      Throws:
      MalformedResumeRequestException - if a <resume/> element is present but is malformed.
    • getPrevId

      @Nonnull public String getPrevId()
      Returns the SM-ID of the former stream that the client wishes to resume.
      Returns:
      the (still Base64-encoded) SM-ID.
    • getH

      public long getH()
      Returns the sequence number of the last stanza that the client received from the server over the former stream.
      Returns:
      a non-negative sequence number.
    • getNamespace

      @Nonnull public String getNamespace()
      Returns the Stream Management namespace that the client used for this request.
      Returns:
      a Stream Management namespace.
    • toString

      public String toString()
      Overrides:
      toString in class Object