Class XMPPBOSHConnection

  • All Implemented Interfaces:
    org.jivesoftware.smack.XMPPConnection

    public class XMPPBOSHConnection
    extends org.jivesoftware.smack.AbstractXMPPConnection
    Creates a connection to an XMPP server via HTTP binding. This is specified in the XEP-0206: XMPP Over BOSH.
    See Also:
    XMPPConnection
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.jivesoftware.smack.AbstractXMPPConnection

        org.jivesoftware.smack.AbstractXMPPConnection.InterceptorWrapper, org.jivesoftware.smack.AbstractXMPPConnection.ListenerWrapper, org.jivesoftware.smack.AbstractXMPPConnection.SyncPointState
      • Nested classes/interfaces inherited from interface org.jivesoftware.smack.XMPPConnection

        org.jivesoftware.smack.XMPPConnection.FromMode
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BOSH_URI
      The BOSH namespace from XEP-0124.
      protected java.lang.String sessionID
      The session ID for the BOSH session with the connection manager.
      static java.lang.String XMPP_BOSH_NS
      The XMPP Over Bosh namespace.
      • Fields inherited from class org.jivesoftware.smack.AbstractXMPPConnection

        ASYNC_BUT_ORDERED, authenticated, authenticatedConnectionInitiallyEstablishedTimestamp, closingStreamReceived, compressionHandler, connected, connectionCounterValue, connectionListeners, connectionLock, currentSmackException, currentXmppException, debugger, host, lastFeaturesReceived, outgoingStreamXmlEnvironment, port, reader, saslFeatureReceived, SMACK_REACTOR, streamFeatures, streamId, tlsHandled, user, wasAuthenticated, writer
    • Constructor Summary

      Constructors 
      Constructor Description
      XMPPBOSHConnection​(java.lang.String username, java.lang.String password, boolean https, java.lang.String host, int port, java.lang.String filePath, org.jxmpp.jid.DomainBareJid xmppServiceDomain)
      Create a HTTP Binding connection to an XMPP server.
      XMPPBOSHConnection​(BOSHConfiguration config)
      Create a HTTP Binding connection to an XMPP server.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void afterSaslAuthenticationSuccess()  
      protected void connectInternal()  
      java.net.InetAddress getLocalAddress()  
      protected void initDebugger()
      Initialize the SmackDebugger which allows to log and debug XML traffic.
      void instantShutdown()  
      boolean isSecureConnection()  
      boolean isUsingCompression()  
      protected void loginInternal​(java.lang.String username, java.lang.String password, org.jxmpp.jid.parts.Resourcepart resource)  
      protected void send​(org.igniterealtime.jbosh.ComposableBody body)
      Send a HTTP request to the connection manager with the provided body element.
      protected void sendInternal​(org.jivesoftware.smack.packet.TopLevelStreamElement element)  
      protected void sendNonBlockingInternal​(org.jivesoftware.smack.packet.TopLevelStreamElement element)  
      protected void shutdown()  
      • Methods inherited from class org.jivesoftware.smack.AbstractXMPPConnection

        addAsyncStanzaListener, addConnectionListener, addMessageInterceptor, addOneTimeSyncCallback, addPresenceInterceptor, addStanzaListener, addStanzaSendingListener, addStreamFeature, addSyncStanzaListener, afterFeaturesReceived, afterSuccessfulLogin, asyncGo, asyncGoLimited, authenticate, bindResourceAndEstablishSession, buildNonzaCallback, callConnectionAuthenticatedListener, callConnectionConnectedListener, callConnectionConnectingListener, connect, createStanzaCollector, createStanzaCollector, createStanzaCollectorAndSend, createStanzaCollectorAndSend, disconnect, disconnect, firePacketSendingListeners, getAuthenticatedConnectionInitiallyEstablishedTimestamp, getConfiguration, getConnectionCounter, getConnectionLock, getFeature, getFromMode, getHost, getLastStanzaReceived, getParsingExceptionCallback, getPort, getReactor, getReplyTimeout, getSmackTlsContext, getStanzaFactory, getStreamId, getStreamOpen, getUsedSaslMechansism, getUser, getXMPPServiceDomain, hasCurrentConnectionException, hasFeature, initState, invokeStanzaCollectorsAndNotifyRecvListeners, isAnonymous, isAuthenticated, isConnected, isSaslAuthenticated, login, login, login, notifyConnectionError, notifyWaitingThreads, onStreamOpen, parseAndProcessNonza, parseAndProcessStanza, parseFeatures, parseFeaturesAndNotify, processStanza, registerIQRequestHandler, removeAsyncStanzaListener, removeConnectionListener, removeMessageInterceptor, removePresenceInterceptor, removeStanzaCollector, removeStanzaListener, removeStanzaSendingListener, removeSyncStanzaListener, schedule, sendAndWaitForResponse, sendAsync, sendAsync, sendIqRequestAndWaitForResponse, sendIqRequestAsync, sendIqRequestAsync, sendNonza, sendNonzaNonBlocking, sendStanza, sendStanzaNonBlocking, sendStreamOpen, setCurrentConnectionExceptionAndNotify, setFromMode, setMaxAsyncOperations, setParsingExceptionCallback, setReplyTimeout, setUnknownIqRequestReplyMode, setWasAuthenticated, throwAlreadyConnectedExceptionIfAppropriate, throwAlreadyLoggedInExceptionIfAppropriate, throwCurrentConnectionException, throwNotConnectedExceptionIfAppropriate, throwNotConnectedExceptionIfAppropriate, toString, trySendStanza, trySendStanza, unregisterIQRequestHandler, unregisterIQRequestHandler, updateOutgoingStreamXmlEnvironmentOnStreamOpen, waitFor, waitForClosingStreamTagFromServer, waitForConditionOrThrowConnectionException
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.jivesoftware.smack.XMPPConnection

        getFeature, hasFeature
    • Field Detail

      • XMPP_BOSH_NS

        public static final java.lang.String XMPP_BOSH_NS
        The XMPP Over Bosh namespace.
        See Also:
        Constant Field Values
      • BOSH_URI

        public static final java.lang.String BOSH_URI
        The BOSH namespace from XEP-0124.
        See Also:
        Constant Field Values
      • sessionID

        protected java.lang.String sessionID
        The session ID for the BOSH session with the connection manager.
    • Constructor Detail

      • XMPPBOSHConnection

        public XMPPBOSHConnection​(java.lang.String username,
                                  java.lang.String password,
                                  boolean https,
                                  java.lang.String host,
                                  int port,
                                  java.lang.String filePath,
                                  org.jxmpp.jid.DomainBareJid xmppServiceDomain)
        Create a HTTP Binding connection to an XMPP server.
        Parameters:
        username - the username to use.
        password - the password to use.
        https - true if you want to use SSL (e.g. false for http://domain.lt:7070/http-bind).
        host - the hostname or IP address of the connection manager (e.g. domain.lt for http://domain.lt:7070/http-bind).
        port - the port of the connection manager (e.g. 7070 for http://domain.lt:7070/http-bind).
        filePath - the file which is described by the URL (e.g. /http-bind for http://domain.lt:7070/http-bind).
        xmppServiceDomain - the XMPP service name (e.g. domain.lt for the user alice@domain.lt)
      • XMPPBOSHConnection

        public XMPPBOSHConnection​(BOSHConfiguration config)
        Create a HTTP Binding connection to an XMPP server.
        Parameters:
        config - The configuration which is used for this connection.
    • Method Detail

      • connectInternal

        protected void connectInternal()
                                throws org.jivesoftware.smack.SmackException,
                                       java.lang.InterruptedException
        Specified by:
        connectInternal in class org.jivesoftware.smack.AbstractXMPPConnection
        Throws:
        org.jivesoftware.smack.SmackException
        java.lang.InterruptedException
      • isSecureConnection

        public boolean isSecureConnection()
        Specified by:
        isSecureConnection in interface org.jivesoftware.smack.XMPPConnection
        Specified by:
        isSecureConnection in class org.jivesoftware.smack.AbstractXMPPConnection
      • isUsingCompression

        public boolean isUsingCompression()
        Specified by:
        isUsingCompression in interface org.jivesoftware.smack.XMPPConnection
        Specified by:
        isUsingCompression in class org.jivesoftware.smack.AbstractXMPPConnection
      • loginInternal

        protected void loginInternal​(java.lang.String username,
                                     java.lang.String password,
                                     org.jxmpp.jid.parts.Resourcepart resource)
                              throws org.jivesoftware.smack.XMPPException,
                                     org.jivesoftware.smack.SmackException,
                                     java.io.IOException,
                                     java.lang.InterruptedException
        Specified by:
        loginInternal in class org.jivesoftware.smack.AbstractXMPPConnection
        Throws:
        org.jivesoftware.smack.XMPPException
        org.jivesoftware.smack.SmackException
        java.io.IOException
        java.lang.InterruptedException
      • sendInternal

        protected void sendInternal​(org.jivesoftware.smack.packet.TopLevelStreamElement element)
                             throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Specified by:
        sendInternal in class org.jivesoftware.smack.AbstractXMPPConnection
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException
        java.lang.InterruptedException
      • sendNonBlockingInternal

        protected void sendNonBlockingInternal​(org.jivesoftware.smack.packet.TopLevelStreamElement element)
                                        throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                               org.jivesoftware.smack.SmackException.OutgoingQueueFullException
        Specified by:
        sendNonBlockingInternal in class org.jivesoftware.smack.AbstractXMPPConnection
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException
        org.jivesoftware.smack.SmackException.OutgoingQueueFullException
      • getLocalAddress

        public java.net.InetAddress getLocalAddress()
      • shutdown

        protected void shutdown()
        Specified by:
        shutdown in class org.jivesoftware.smack.AbstractXMPPConnection
      • instantShutdown

        public void instantShutdown()
        Specified by:
        instantShutdown in class org.jivesoftware.smack.AbstractXMPPConnection
      • send

        protected void send​(org.igniterealtime.jbosh.ComposableBody body)
                     throws org.igniterealtime.jbosh.BOSHException
        Send a HTTP request to the connection manager with the provided body element.
        Parameters:
        body - the body which will be sent.
        Throws:
        org.igniterealtime.jbosh.BOSHException - if an BOSH (Bidirectional-streams Over Synchronous HTTP, XEP-0124) related error occurs
      • initDebugger

        protected void initDebugger()
        Initialize the SmackDebugger which allows to log and debug XML traffic.
        Overrides:
        initDebugger in class org.jivesoftware.smack.AbstractXMPPConnection
      • afterSaslAuthenticationSuccess

        protected void afterSaslAuthenticationSuccess()
                                               throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                                      java.lang.InterruptedException,
                                                      org.jivesoftware.smack.SmackException.SmackWrappedException
        Overrides:
        afterSaslAuthenticationSuccess in class org.jivesoftware.smack.AbstractXMPPConnection
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException
        java.lang.InterruptedException
        org.jivesoftware.smack.SmackException.SmackWrappedException