Class LocalComponentSession

    • Method Detail

      • createSession

        public static LocalComponentSession createSession​(String serverName,
                                                          org.xmlpull.v1.XmlPullParser xpp,
                                                          Connection connection)
                                                   throws org.xmlpull.v1.XmlPullParserException
        Returns a newly created session between the server and a component. The session will be created and returned only if all the checkings were correct.

        A domain will be binded for the new connecting component. This method is following the JEP-114 where the domain to bind is sent in the TO attribute of the stream header.

        serverName - the name of the server where the session is connecting to.
        xpp - the parser that is reading the provided XML through the connection.
        connection - the connection with the component.
        a newly created session between the server and a component.
        org.xmlpull.v1.XmlPullParserException - if there was an XML error while creating the session.
      • getAvailableStreamFeatures

        public List<org.dom4j.Element> getAvailableStreamFeatures()
        Description copied from class: LocalSession
        Returns a text with the available stream features. Each subclass may return different values depending whether the session has been authenticated or not.
        Specified by:
        getAvailableStreamFeatures in class LocalSession
        a text with the available stream features or null to add nothing.
      • setDetached

        public void setDetached()
        Description copied from class: LocalSession
        Set the session to detached mode, indicating that the underlying connection has been closed.
        setDetached in class LocalSession
      • reattach

        public void reattach​(LocalSession connectionProvider,
                             long h)
        Description copied from class: LocalSession
        Reattach the (existing) session to the connection provided by a new session (a session that will be replaced by the older, pre-existing session). The connection must already be initialized as a running XML Stream, normally by having run through XEP-0198 resumption.
        reattach in class LocalSession
        connectionProvider - Session from which to obtain the connection from.
        h - the sequence number of the last handled stanza sent over the former stream
      • getConnection

        public Connection getConnection()
        Returns the connection associated with this Session.
        getConnection in class LocalSession
        The connection for this session
      • authenticate

        public boolean authenticate​(String digest)
        Authenticate the external component using a digest method. The digest includes the stream ID and the secret key of the main domain of the external component. A component needs to authenticate just once but it may bind several domains.
        digest - the digest sent in the handshake.
        true if the authentication was successful.