public class XMPPBOSHConnection extends AbstractXMPPConnection
XMPPConnection
AbstractXMPPConnection.InterceptorWrapper, AbstractXMPPConnection.ListenerWrapper
XMPPConnection.FromMode
Modifier and Type | Field and Description |
---|---|
static String |
BOSH_URI
The BOSH namespace from XEP-0124.
|
protected String |
sessionID
The session ID for the BOSH session with the connection manager.
|
static String |
XMPP_BOSH_NS
The XMPP Over Bosh namespace.
|
authenticated, compressionHandler, connected, connectionCounterValue, connectionListeners, connectionLock, debugger, host, hostAddresses, lastFeaturesReceived, port, reader, saslAuthentication, saslFeatureReceived, streamFeatures, streamId, user, wasAuthenticated, writer
Constructor and Description |
---|
XMPPBOSHConnection(BOSHConfiguration config)
Create a HTTP Binding connection to an XMPP server.
|
XMPPBOSHConnection(String username,
String password,
boolean https,
String host,
int port,
String filePath,
String xmppDomain)
Create a HTTP Binding connection to an XMPP server.
|
Modifier and Type | Method and Description |
---|---|
protected void |
connectInternal()
Abstract method that concrete subclasses of XMPPConnection need to implement to perform their
way of XMPP connection establishment.
|
protected void |
initDebugger()
Initialize the SmackDebugger which allows to log and debug XML traffic.
|
boolean |
isSecureConnection()
Returns true if the connection to the server has successfully negotiated encryption.
|
boolean |
isUsingCompression()
Returns true if network traffic is being compressed.
|
protected void |
loginAnonymously() |
protected void |
loginNonAnonymously(String username,
String password,
String resource) |
protected void |
notifyConnectionError(Exception e)
Sends out a notification that there was an error with the connection
and closes the connection.
|
protected void |
send(org.igniterealtime.jbosh.ComposableBody body)
Send a HTTP request to the connection manager with the provided body element.
|
void |
send(PlainStreamElement element)
Send a PlainStreamElement.
|
protected void |
sendStanzaInternal(Stanza packet) |
protected void |
shutdown()
Closes the connection by setting presence to unavailable and closing the
HTTP client.
|
addAsyncStanzaListener, addConnectionListener, addOneTimeSyncCallback, addPacketInterceptor, addPacketListener, addPacketSendingListener, addSyncStanzaListener, afterFeaturesReceived, afterSuccessfulLogin, asyncGo, bindResourceAndEstablishSession, callConnectionAuthenticatedListener, callConnectionClosedOnErrorListener, callConnectionConnectedListener, connect, createPacketCollector, createPacketCollector, createPacketCollectorAndSend, createPacketCollectorAndSend, disconnect, disconnect, finalize, firePacketSendingListeners, getConfiguration, getConnectionCounter, getConnectionCreationListeners, getConnectionLock, getFeature, getFromMode, getHost, getLastStanzaReceived, getPacketReplyTimeout, getParsingExceptionCallback, getPort, getSASLAuthentication, getServiceName, getStreamId, getUser, hasFeature, invokePacketCollectorsAndNotifyRecvListeners, isAnonymous, isAuthenticated, isConnected, login, login, login, notifyReconnection, parseAndProcessStanza, parseFeatures, populateHostAddresses, processPacket, registerIQRequestHandler, removeAsyncStanzaListener, removeConnectionListener, removePacketCollector, removePacketInterceptor, removePacketListener, removePacketSendingListener, removeSyncStanzaListener, schedule, sendIqWithResponseCallback, sendIqWithResponseCallback, sendIqWithResponseCallback, sendPacket, sendStanza, sendStanzaWithResponseCallback, sendStanzaWithResponseCallback, sendStanzaWithResponseCallback, setFromMode, setPacketReplyTimeout, setParsingExceptionCallback, setReplyToUnknownIq, setReplyToUnknownIqDefault, setWasAuthenticated, throwAlreadyConnectedExceptionIfAppropriate, throwAlreadyLoggedInExceptionIfAppropriate, throwNotConnectedExceptionIfAppropriate, unregisterIQRequestHandler, unregisterIQRequestHandler
public static final String XMPP_BOSH_NS
public static final String BOSH_URI
public XMPPBOSHConnection(String username, String password, boolean https, String host, int port, String filePath, String xmppDomain)
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).xmppDomain
- the XMPP service name
(e.g. domain.lt for the user alice@domain.lt)public XMPPBOSHConnection(BOSHConfiguration config)
config
- The configuration which is used for this connection.protected void connectInternal() throws SmackException
AbstractXMPPConnection
connectInternal
in class AbstractXMPPConnection
SmackException
public boolean isSecureConnection()
XMPPConnection
isSecureConnection
in interface XMPPConnection
isSecureConnection
in class AbstractXMPPConnection
public boolean isUsingCompression()
XMPPConnection
isUsingCompression
in interface XMPPConnection
isUsingCompression
in class AbstractXMPPConnection
protected void loginNonAnonymously(String username, String password, String resource) throws XMPPException, SmackException, IOException
loginNonAnonymously
in class AbstractXMPPConnection
XMPPException
SmackException
IOException
protected void loginAnonymously() throws XMPPException, SmackException, IOException
loginAnonymously
in class AbstractXMPPConnection
XMPPException
SmackException
IOException
public void send(PlainStreamElement element) throws SmackException.NotConnectedException
XMPPConnection
This method is not meant for end-user usage! It allows sending plain stream elements, which should not be done by a user manually. Doing so may result in a unstable or unusable connection. Certain Smack APIs use this method to send plain stream elements.
send
in interface XMPPConnection
send
in class AbstractXMPPConnection
SmackException.NotConnectedException
protected void sendStanzaInternal(Stanza packet) throws SmackException.NotConnectedException
sendStanzaInternal
in class AbstractXMPPConnection
SmackException.NotConnectedException
protected void shutdown()
AbstractXMPPConnection.disconnect()
the connection's
BOSH stanza(/packet) reader will not be removed; thus connection's state is kept.shutdown
in class AbstractXMPPConnection
protected void send(org.igniterealtime.jbosh.ComposableBody body) throws org.igniterealtime.jbosh.BOSHException
body
- the body which will be sent.org.igniterealtime.jbosh.BOSHException
protected void initDebugger()
initDebugger
in class AbstractXMPPConnection
protected void notifyConnectionError(Exception e)
e
- the exception that causes the connection close event.