public interface WebdavApiClient
ClientFactory
class.
Obtaining an Instance of a Given Client
The Java client API implements a standard Factory design pattern for client instance creation.
ClientFactory
is the class that implements a factory and provides a way to obtain a
client object of a given type by calling a relevant method. For example:
string serviceUrl = "http://localhost:8080/SplusServer";
string username = "myusername";
string password = "mypassword";
WebdavApiClient api = ClientFactory.getWebdavClient(serviceUrl, username, password);
You can use the WebdavApiClient to manipulate files and folders in the WebDAV repository on the server, or to get information about them. You can:
ClientFactory.getWebdavClient(String)
,
ClientFactory.getWebdavClient(String, String, String)
Modifier and Type | Method and Description |
---|---|
boolean |
copy(java.lang.String url,
java.lang.String destination,
boolean overwrite)
Copy a file.
|
boolean |
createFolder(java.lang.String url)
Create a new collection folder.
|
boolean |
delete(java.lang.String url)
Delete the specified resource from the collection.
|
boolean |
downloadFile(java.lang.String url,
java.lang.String filepath)
Downloads the specified file from the specified URL and put the file
into the specified file path.
|
boolean |
exists(java.lang.String url)
Check if the specified resource exists.
|
java.lang.String[] |
getFolderContents(java.lang.String url)
List the resources in the current folder.
|
java.lang.String[] |
getProperties(java.lang.String url,
java.lang.String[] propNames)
Retrieve the list of properties for the specified resource.
|
java.lang.String[] |
getPropertyNames(java.lang.String url)
Retrieve all property names for the resource.
|
boolean |
isFolder(java.lang.String url)
Check if the specified folder exists.
|
boolean |
move(java.lang.String url,
java.lang.String destination,
boolean overwrite)
Move a file to the specified location, optionally overwriting a file
of the same name that exists at that location.
|
boolean |
removeProperties(java.lang.String url,
java.lang.String[] propNames)
Remove a list of properties.
|
boolean |
setProperties(java.lang.String url,
java.lang.String[] propNames,
java.lang.String[] propValues)
Set a list of properties for the specified resource.
|
boolean |
uploadFile(java.lang.String url,
java.lang.String filepath)
Upload (PUT) the specified file to the current directory.
|
boolean downloadFile(java.lang.String url, java.lang.String filepath) throws ApiException
For an example of downloadFile, see createFolder(String)
.
url
- The URL of the file in the storage.file
- The local destination file name, including the path, to download to.true
if the download success was successful; otherwise false
.ApiException
boolean uploadFile(java.lang.String url, java.lang.String filepath) throws ApiException
url
- The URL of the file in the storage (note that folders have to exist).filepath
- The filename and path to the file to upload.true
if uploading the file was successful; otherwise false
.ApiException
java.lang.String[] getFolderContents(java.lang.String url) throws ApiException
url
- The URL of the folder for which you want the list of contents.ApiException
boolean copy(java.lang.String url, java.lang.String destination, boolean overwrite) throws ApiException
url
- The URL of the source file.destination
- The file location where you want to place the copy.overwrite
- Specify whether to overwrite a file if it already exists at that location.true
if the file was successfully copied; otherwise false
.WebdavException
ApiException
boolean createFolder(java.lang.String url) throws ApiException
url
- The URL of the collection folder to create.true
if the folder (collection) was created successfully; otherwise false
.WebdavException
ApiException
boolean move(java.lang.String url, java.lang.String destination, boolean overwrite) throws ApiException
url
- The URL of the file to move.true
if the file was moved successfully; otherwise false
.ApiException
boolean delete(java.lang.String url) throws ApiException
url
- The URL of the resource to delete.true
if the resource was deleted successfully; otherwise false
.WebdavException
ApiException
boolean exists(java.lang.String url) throws ApiException
url
- The URL of the resource to check.true
if the specified resource exists; otherwise false
.WebdavException
ApiException
boolean isFolder(java.lang.String url) throws ApiException
url
- The URL of the folder to check.true
if the folder exists; otherwise false
.WebdavException
ApiException
boolean setProperties(java.lang.String url, java.lang.String[] propNames, java.lang.String[] propValues) throws ApiException
url
- The URL of the resource for which you want to set properties.propNames
- The names of the properties to set.propValues
- The values of the properties to set.true
if setting the specified properties succeeded; otherwise false
.ApiException
java.lang.String[] getProperties(java.lang.String url, java.lang.String[] propNames) throws ApiException
url
- The URL of the resource whose properties you want to retrieve.propNames
- The names of the properties to retrieve.ApiException
java.lang.String[] getPropertyNames(java.lang.String url) throws ApiException
url
- The URL for the resource whose property names you want to retrieve.ApiException
boolean removeProperties(java.lang.String url, java.lang.String[] propNames) throws ApiException
url
- The URL for the resource whose properties you want to remove.propNames
- The names of the properties to remove.true
if the properties are successfully removed; otherwise false
.ApiException