Class XMPPBOSHConnection

java.lang.Object
org.jivesoftware.smack.AbstractXMPPConnection
org.jivesoftware.smack.bosh.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 final String
    The BOSH namespace from XEP-0124.
    protected String
    The session ID for the BOSH session with the connection manager.
    static final String
    The XMPP Over Bosh namespace.

    Fields inherited from class org.jivesoftware.smack.AbstractXMPPConnection

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

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

    Modifier and Type
    Method
    Description
    protected void
     
    protected void
     
     
    protected void
    Initialize the SmackDebugger which allows to log and debug XML traffic.
    void
     
    boolean
     
    boolean
     
    protected void
    loginInternal(String username, 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
     

    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, 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 Details

    • XMPP_BOSH_NS

      public static final String XMPP_BOSH_NS
      The XMPP Over Bosh namespace.
      See Also:
    • BOSH_URI

      public static final String BOSH_URI
      The BOSH namespace from XEP-0124.
      See Also:
    • sessionID

      protected String sessionID
      The session ID for the BOSH session with the connection manager.
  • Constructor Details

    • XMPPBOSHConnection

      public XMPPBOSHConnection(String username, String password, boolean https, String host, int port, 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 Details

    • connectInternal

      protected void connectInternal() throws org.jivesoftware.smack.SmackException, InterruptedException
      Specified by:
      connectInternal in class org.jivesoftware.smack.AbstractXMPPConnection
      Throws:
      org.jivesoftware.smack.SmackException
      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(String username, String password, org.jxmpp.jid.parts.Resourcepart resource) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, IOException, InterruptedException
      Specified by:
      loginInternal in class org.jivesoftware.smack.AbstractXMPPConnection
      Throws:
      org.jivesoftware.smack.XMPPException
      org.jivesoftware.smack.SmackException
      IOException
      InterruptedException
    • sendInternal

      protected void sendInternal(org.jivesoftware.smack.packet.TopLevelStreamElement element) throws org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Specified by:
      sendInternal in class org.jivesoftware.smack.AbstractXMPPConnection
      Throws:
      org.jivesoftware.smack.SmackException.NotConnectedException
      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 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, InterruptedException, org.jivesoftware.smack.SmackException.SmackWrappedException
      Overrides:
      afterSaslAuthenticationSuccess in class org.jivesoftware.smack.AbstractXMPPConnection
      Throws:
      org.jivesoftware.smack.SmackException.NotConnectedException
      InterruptedException
      org.jivesoftware.smack.SmackException.SmackWrappedException