Package org.jivesoftware.smack.bosh
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.AbstractXMPPConnectionCreates 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
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBOSH_URIThe BOSH namespace from XEP-0124.protected java.lang.StringsessionIDThe session ID for the BOSH session with the connection manager.static java.lang.StringXMPP_BOSH_NSThe 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, inOrderListeners, 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 voidafterSaslAuthenticationSuccess()protected voidconnectInternal()protected voidinitDebugger()Initialize the SmackDebugger which allows to log and debug XML traffic.voidinstantShutdown()booleanisSecureConnection()booleanisUsingCompression()protected voidloginInternal(java.lang.String username, java.lang.String password, org.jxmpp.jid.parts.Resourcepart resource)protected voidsend(org.igniterealtime.jbosh.ComposableBody body)Send a HTTP request to the connection manager with the provided body element.voidsendNonza(org.jivesoftware.smack.packet.Nonza element)protected voidsendStanzaInternal(org.jivesoftware.smack.packet.Stanza packet)protected voidshutdown()Closes the connection by setting presence to unavailable and closing the HTTP client.-
Methods inherited from class org.jivesoftware.smack.AbstractXMPPConnection
addAsyncStanzaListener, addConnectionListener, addMessageInterceptor, addOneTimeSyncCallback, addPresenceInterceptor, addStanzaInterceptor, 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, 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, removeStanzaInterceptor, removeStanzaListener, removeStanzaSendingListener, removeSyncStanzaListener, schedule, sendAndWaitForResponse, sendAsync, sendAsync, sendIqRequestAndWaitForResponse, sendIqRequestAsync, sendIqRequestAsync, sendStanza, sendStreamOpen, setCurrentConnectionExceptionAndNotify, setFromMode, setMaxAsyncOperations, setParsingExceptionCallback, setReplyTimeout, setUnknownIqRequestReplyMode, setWasAuthenticated, throwAlreadyConnectedExceptionIfAppropriate, throwAlreadyLoggedInExceptionIfAppropriate, throwCurrentConnectionException, throwNotConnectedExceptionIfAppropriate, throwNotConnectedExceptionIfAppropriate, toString, trySendStanza, trySendStanza, unregisterIQRequestHandler, unregisterIQRequestHandler, waitFor, waitForClosingStreamTagFromServer, waitForConditionOrConnectionException, waitForConditionOrConnectionException, waitForConditionOrThrowConnectionException
-
-
-
-
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:
connectInternalin classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.SmackExceptionjava.lang.InterruptedException
-
isSecureConnection
public boolean isSecureConnection()
- Specified by:
isSecureConnectionin interfaceorg.jivesoftware.smack.XMPPConnection- Specified by:
isSecureConnectionin classorg.jivesoftware.smack.AbstractXMPPConnection
-
isUsingCompression
public boolean isUsingCompression()
- Specified by:
isUsingCompressionin interfaceorg.jivesoftware.smack.XMPPConnection- Specified by:
isUsingCompressionin classorg.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:
loginInternalin classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.XMPPExceptionorg.jivesoftware.smack.SmackExceptionjava.io.IOExceptionjava.lang.InterruptedException
-
sendNonza
public void sendNonza(org.jivesoftware.smack.packet.Nonza element) throws org.jivesoftware.smack.SmackException.NotConnectedException- Specified by:
sendNonzain interfaceorg.jivesoftware.smack.XMPPConnection- Specified by:
sendNonzain classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.SmackException.NotConnectedException
-
sendStanzaInternal
protected void sendStanzaInternal(org.jivesoftware.smack.packet.Stanza packet) throws org.jivesoftware.smack.SmackException.NotConnectedException- Specified by:
sendStanzaInternalin classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.SmackException.NotConnectedException
-
shutdown
protected void shutdown()
Closes the connection by setting presence to unavailable and closing the HTTP client. The shutdown logic will be used during a planned disconnection or when dealing with an unexpected disconnection. UnlikeAbstractXMPPConnection.disconnect()the connection's BOSH stanza reader will not be removed; thus connection's state is kept.- Specified by:
shutdownin classorg.jivesoftware.smack.AbstractXMPPConnection
-
instantShutdown
public void instantShutdown()
- Specified by:
instantShutdownin classorg.jivesoftware.smack.AbstractXMPPConnection
-
send
protected void send(org.igniterealtime.jbosh.ComposableBody body) throws org.igniterealtime.jbosh.BOSHExceptionSend 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:
initDebuggerin classorg.jivesoftware.smack.AbstractXMPPConnection
-
afterSaslAuthenticationSuccess
protected void afterSaslAuthenticationSuccess() throws org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException, org.jivesoftware.smack.SmackException.SmackWrappedException- Overrides:
afterSaslAuthenticationSuccessin classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.SmackException.NotConnectedExceptionjava.lang.InterruptedExceptionorg.jivesoftware.smack.SmackException.SmackWrappedException
-
-