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.AbstractXMPPConnection
Creates a connection to an XMPP server via HTTP binding.
This is specified in the XEP-0206: XMPP Over BOSH.
- See Also:
-
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.SyncPointStateNested classes/interfaces inherited from interface org.jivesoftware.smack.XMPPConnection
org.jivesoftware.smack.XMPPConnection.FromMode -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe BOSH namespace from XEP-0124.protected StringThe session ID for the BOSH session with the connection manager.static final StringThe 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
ConstructorsConstructorDescriptionXMPPBOSHConnection(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.XMPPBOSHConnection(BOSHConfiguration config) Create a HTTP Binding connection to an XMPP server. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidInitialize the SmackDebugger which allows to log and debug XML traffic.voidbooleanbooleanprotected voidloginInternal(String username, 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.protected voidsendInternal(org.jivesoftware.smack.packet.TopLevelStreamElement element) protected voidsendNonBlockingInternal(org.jivesoftware.smack.packet.TopLevelStreamElement element) protected voidshutdown()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, waitForConditionOrThrowConnectionExceptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jivesoftware.smack.XMPPConnection
getFeature, hasFeature
-
Field Details
-
XMPP_BOSH_NS
The XMPP Over Bosh namespace.- See Also:
-
BOSH_URI
The BOSH namespace from XEP-0124.- See Also:
-
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
Create a HTTP Binding connection to an XMPP server.- Parameters:
config- The configuration which is used for this connection.
-
-
Method Details
-
connectInternal
- Specified by:
connectInternalin classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.SmackExceptionInterruptedException
-
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(String username, String password, org.jxmpp.jid.parts.Resourcepart resource) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, IOException, InterruptedException - Specified by:
loginInternalin classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.XMPPExceptionorg.jivesoftware.smack.SmackExceptionIOExceptionInterruptedException
-
sendInternal
protected void sendInternal(org.jivesoftware.smack.packet.TopLevelStreamElement element) throws org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException - Specified by:
sendInternalin classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.SmackException.NotConnectedExceptionInterruptedException
-
sendNonBlockingInternal
protected void sendNonBlockingInternal(org.jivesoftware.smack.packet.TopLevelStreamElement element) throws org.jivesoftware.smack.SmackException.NotConnectedException, org.jivesoftware.smack.SmackException.OutgoingQueueFullException - Specified by:
sendNonBlockingInternalin classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.SmackException.NotConnectedExceptionorg.jivesoftware.smack.SmackException.OutgoingQueueFullException
-
getLocalAddress
-
shutdown
protected void shutdown()- 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.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:
initDebuggerin classorg.jivesoftware.smack.AbstractXMPPConnection
-
afterSaslAuthenticationSuccess
protected void afterSaslAuthenticationSuccess() throws org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException, org.jivesoftware.smack.SmackException.SmackWrappedException- Overrides:
afterSaslAuthenticationSuccessin classorg.jivesoftware.smack.AbstractXMPPConnection- Throws:
org.jivesoftware.smack.SmackException.NotConnectedExceptionInterruptedExceptionorg.jivesoftware.smack.SmackException.SmackWrappedException
-