public final class HttpFileUploadManager extends Manager
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NAMESPACE
Namespace of XEP-0363 v0.4 or higher.
|
static java.lang.String |
NAMESPACE_0_2
Namespace of XEP-0363 v0.2 or lower.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
discoverUploadService()
Discover upload service.
|
UploadService |
getDefaultUploadService()
Get default upload service if it was discovered.
|
static HttpFileUploadManager |
getInstanceFor(XMPPConnection connection)
Obtain the HttpFileUploadManager responsible for a connection.
|
boolean |
isUploadServiceDiscovered()
Check if upload service was discovered.
|
static UploadService.Version |
namespaceToVersion(java.lang.String namespace) |
Slot |
requestSlot(java.lang.String filename,
long fileSize)
Request a new upload slot from default upload service (if discovered).
|
Slot |
requestSlot(java.lang.String filename,
long fileSize,
java.lang.String contentType)
Request a new upload slot with optional content type from default upload service (if discovered).
|
Slot |
requestSlot(java.lang.String filename,
long fileSize,
java.lang.String contentType,
org.jxmpp.jid.DomainBareJid uploadServiceAddress)
Request a new upload slot with optional content type from custom upload service.
|
void |
setTlsContext(javax.net.ssl.SSLContext tlsContext) |
java.net.URL |
uploadFile(java.io.File file)
Request slot and uploaded file to HTTP file upload service.
|
java.net.URL |
uploadFile(java.io.File file,
UploadProgressListener listener)
Request slot and uploaded file to HTTP file upload service with progress callback.
|
void |
useTlsSettingsFrom(ConnectionConfiguration connectionConfiguration) |
connection, getAuthenticatedConnectionOrThrow, schedulepublic static final java.lang.String NAMESPACE
public static final java.lang.String NAMESPACE_0_2
public static HttpFileUploadManager getInstanceFor(XMPPConnection connection)
connection - the connection object.public boolean discoverUploadService() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException, SmackException.NoResponseException
XMPPException.XMPPErrorExceptionSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionSmackException.NoResponseExceptionpublic boolean isUploadServiceDiscovered()
public UploadService getDefaultUploadService()
public java.net.URL uploadFile(java.io.File file) throws java.lang.InterruptedException, XMPPException.XMPPErrorException, SmackException, java.io.IOException
file - file to be uploadedjava.lang.InterruptedExceptionXMPPException.XMPPErrorExceptionSmackExceptionjava.io.IOException - in case of HTTP upload errorspublic java.net.URL uploadFile(java.io.File file, UploadProgressListener listener) throws java.lang.InterruptedException, XMPPException.XMPPErrorException, SmackException, java.io.IOException
file - file to be uploadedlistener - upload progress listener of nulljava.lang.InterruptedExceptionXMPPException.XMPPErrorExceptionSmackExceptionjava.io.IOExceptionpublic Slot requestSlot(java.lang.String filename, long fileSize) throws java.lang.InterruptedException, XMPPException.XMPPErrorException, SmackException
filename - name of file to be uploadedfileSize - file size in bytes.java.lang.IllegalArgumentException - if fileSize is less than or equal to zero or greater than the maximum size
supported by the service.java.lang.InterruptedExceptionXMPPException.XMPPErrorExceptionSmackException.NotConnectedExceptionSmackException.NoResponseExceptionSmackExceptionpublic Slot requestSlot(java.lang.String filename, long fileSize, java.lang.String contentType) throws SmackException, java.lang.InterruptedException, XMPPException.XMPPErrorException
filename - name of file to be uploadedfileSize - file size in bytes.contentType - file content-type or nulljava.lang.IllegalArgumentException - if fileSize is less than or equal to zero or greater than the maximum size
supported by the service.SmackException.NotConnectedExceptionjava.lang.InterruptedExceptionXMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackExceptionpublic Slot requestSlot(java.lang.String filename, long fileSize, java.lang.String contentType, org.jxmpp.jid.DomainBareJid uploadServiceAddress) throws SmackException, java.lang.InterruptedException, XMPPException.XMPPErrorException
filename - name of file to be uploadedfileSize - file size in bytes.contentType - file content-type or nulluploadServiceAddress - the address of the upload service to use or null for default onejava.lang.IllegalArgumentException - if fileSize is less than or equal to zero or greater than the maximum size
supported by the service.SmackExceptionjava.lang.InterruptedExceptionXMPPException.XMPPErrorExceptionpublic void setTlsContext(javax.net.ssl.SSLContext tlsContext)
public void useTlsSettingsFrom(ConnectionConfiguration connectionConfiguration)
public static UploadService.Version namespaceToVersion(java.lang.String namespace)