public interface Sardine
| Modifier and Type | Method and Description |
|---|---|
void |
copy(String sourceUrl,
String destinationUrl)
Copy a url from source to destination using WebDAV
COPY. |
void |
copy(String sourceUrl,
String destinationUrl,
boolean overwrite)
Copy a url from source to destination using WebDAV
COPY. |
void |
createDirectory(String url)
Uses WebDAV
MKCOL to create a directory at the specified url |
void |
delete(String url)
Delete a resource using HTTP
DELETE at the specified url |
void |
disableCompression()
Disables support for HTTP compression.
|
void |
disablePreemptiveAuthentication()
Disable preemptive authentication.
|
void |
enableCompression()
Enables HTTP GZIP compression.
|
void |
enablePreemptiveAuthentication(String hostname)
Send a
Basic authentication header with each request even before 401 is returned. |
void |
enablePreemptiveAuthentication(String hostname,
int httpPort,
int httpsPort)
Send a
Basic authentication header with each request even before 401 is returned. |
void |
enablePreemptiveAuthentication(URL url)
Send a
Basic authentication header with each request even before 401 is returned. |
boolean |
exists(String url)
Performs a HTTP
HEAD request to see if a resource exists or not. |
InputStream |
get(String url)
Uses HTTP
GET to download data from a server. |
InputStream |
get(String url,
Map<String,String> headers)
Uses HTTP
GET to download data from a server. |
DavAcl |
getAcl(String url)
Read access control list for resource
|
List<String> |
getPrincipalCollectionSet(String url)
The principals that are available on the server that implements this resource.
|
List<DavPrincipal> |
getPrincipals(String url)
List the principals that can be used to set ACLs on given url
|
DavQuota |
getQuota(String url)
Read quota properties for resource
|
List<DavResource> |
getResources(String url)
Deprecated.
|
void |
ignoreCookies()
Ignores cookies.
|
List<DavResource> |
list(String url)
Gets a directory listing using WebDAV
PROPFIND. |
List<DavResource> |
list(String url,
int depth)
Gets a directory listing using WebDAV
PROPFIND. |
List<DavResource> |
list(String url,
int depth,
boolean allProp)
Gets a directory listing using WebDAV
PROPFIND. |
List<DavResource> |
list(String url,
int depth,
Set<QName> props)
Gets a directory listing using WebDAV
PROPFIND. |
String |
lock(String url)
Put an exclusive write lock on this resource.
|
void |
move(String sourceUrl,
String destinationUrl)
Move a url to from source to destination using WebDAV
MOVE. |
void |
move(String sourceUrl,
String destinationUrl,
boolean overwrite)
Move a url to from source to destination using WebDAV
MOVE. |
List<DavResource> |
patch(String url,
List<Element> addProps,
List<QName> removeProps)
Add or remove custom properties for a url using WebDAV
PROPPATCH. |
List<DavResource> |
patch(String url,
Map<QName,String> addProps)
Add custom properties for a url WebDAV
PROPPATCH. |
List<DavResource> |
patch(String url,
Map<QName,String> addProps,
List<QName> removeProps)
Add or remove custom properties for a url using WebDAV
PROPPATCH. |
List<DavResource> |
propfind(String url,
int depth,
Set<QName> props)
Fetches a resource using WebDAV
PROPFIND. |
void |
put(String url,
byte[] data)
Uses HTTP
PUT to send data to a server. |
void |
put(String url,
byte[] data,
String contentType)
Uses
PUT to send data to a server with a specific content type
header. |
void |
put(String url,
File localFile,
String contentType)
Uses
PUT to upload file to a server with specific contentType. |
void |
put(String url,
File localFile,
String contentType,
boolean expectContinue)
Uses
PUT to upload file to a server with specific contentType. |
void |
put(String url,
InputStream dataStream)
Uses
PUT to send data to a server. |
void |
put(String url,
InputStream dataStream,
Map<String,String> headers)
Uses
PUT to send data to a server with specific headers. |
void |
put(String url,
InputStream dataStream,
String contentType)
Uses
PUT to send data to a server with a specific content
type header. |
void |
put(String url,
InputStream dataStream,
String contentType,
boolean expectContinue)
Uses
PUT to send data to a server with a specific content
type header. |
void |
put(String url,
InputStream dataStream,
String contentType,
boolean expectContinue,
long contentLength)
Uses
PUT to send data to a server with a specific content
type header. |
String |
refreshLock(String url,
String token,
String file)
A LOCK request with no request body is a "LOCK refresh" request.
|
<T> T |
report(String url,
int depth,
SardineReport<T> report)
Runs a report on the given resource using WebDAV
REPORT. |
List<DavResource> |
search(String url,
String language,
String query)
Perform a search of the Webdav repository.
|
void |
setAcl(String url,
List<DavAce> aces)
Write access control list for resource
|
void |
setCredentials(String username,
String password)
Add credentials to any scope.
|
void |
setCredentials(String username,
String password,
String domain,
String workstation) |
void |
setCustomProps(String url,
Map<String,String> addProps,
List<String> removeProps)
Deprecated.
|
void |
shutdown()
Releasing any resources that might be held
open.
|
void |
unlock(String url,
String token)
Unlock the resource.
|
void setCredentials(String username, String password)
username - Use in authentication header credentialspassword - Use in authentication header credentialsvoid setCredentials(String username, String password, String domain, String workstation)
username - Use in authentication header credentialspassword - Use in authentication header credentialsdomain - NTLM authenticationworkstation - NTLM authentication@Deprecated List<DavResource> getResources(String url) throws IOException
IOExceptionlist(String)List<DavResource> list(String url) throws IOException
PROPFIND.url - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failureList<DavResource> list(String url, int depth) throws IOException
PROPFIND.url - Path to the resource including protocol and hostnamedepth - The depth to look at (use 0 for single resource, 1 for directory listing,
-1 for infinite recursion)IOException - I/O error or HTTP response validation failureList<DavResource> list(String url, int depth, Set<QName> props) throws IOException
PROPFIND.url - Path to the resource including protocol and hostnamedepth - The depth to look at (use 0 for single resource, 1 for directory listing,
-1 for infinite recursion)props - Additional properties which should be requested.IOException - I/O error or HTTP response validation failureList<DavResource> list(String url, int depth, boolean allProp) throws IOException
PROPFIND.url - Path to the resource including protocol and hostnamedepth - The depth to look at (use 0 for single resource, 1 for directory listing,
-1 for infinite recursion)allProp - If allprop should be used, which can be inefficient sometimes;
warning: no allprop does not retrieve custom props, just the basic onesIOException - I/O error or HTTP response validation failureList<DavResource> propfind(String url, int depth, Set<QName> props) throws IOException
PROPFIND. Only the specified properties
are retrieved.url - Path to the resource including protocol and hostnamedepth - The depth to look at (use 0 for single resource, 1 for directory listing,
-1 for infinite recursion)props - Set of properties to be requestedIOException - I/O error or HTTP response validation failure<T> T report(String url, int depth, SardineReport<T> report) throws IOException
REPORT.url - Path to the resource including protocol and hostnamedepth - The depth to look at (use 0 for single resource, 1 for directory listing,
-1 for infinite recursion)report - The report to runIOException - I/O error or HTTP response validation failureList<DavResource> search(String url, String language, String query) throws IOException
url - The base resource to search from.language - The language the query is formed in.query - The query string to be processed by the webdav server.IOException - I/O error or HTTP response validation failure.@Deprecated void setCustomProps(String url, Map<String,String> addProps, List<String> removeProps) throws IOException
IOExceptionpatch(String, java.util.Map, java.util.List)List<DavResource> patch(String url, Map<QName,String> addProps) throws IOException
PROPPATCH.url - Path to the resource including protocol and hostnameaddProps - Properties to add to resource. If a property already exists then its value is replaced.IOException - I/O error or HTTP response validation failureList<DavResource> patch(String url, Map<QName,String> addProps, List<QName> removeProps) throws IOException
PROPPATCH.url - Path to the resource including protocol and hostnameaddProps - Properties to add to resource. If a property already exists then its value is replaced.removeProps - Properties to remove from resource. Specifying the removal of a property that does not exist is not an error.IOException - I/O error or HTTP response validation failureList<DavResource> patch(String url, List<Element> addProps, List<QName> removeProps) throws IOException
PROPPATCH.url - Path to the resource including protocol and hostnameaddProps - Properties to add to resource. If a property already exists then its value is replaced.removeProps - Properties to remove from resource. Specifying the removal of a property that does not exist is not an error.IOException - I/O error or HTTP response validation failureInputStream get(String url) throws IOException
GET to download data from a server. The stream must be closed after reading.url - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failureInputStream get(String url, Map<String,String> headers) throws IOException
GET to download data from a server. The stream must be closed after reading.url - Path to the resource including protocol and hostnameheaders - Additional HTTP headers to add to the requestIOException - I/O error or HTTP response validation failurevoid put(String url, byte[] data) throws IOException
PUT to send data to a server. Repeatable on authentication failure.url - Path to the resource including protocol and hostnamedata - Input sourceIOException - I/O error or HTTP response validation failurevoid put(String url, InputStream dataStream) throws IOException
PUT to send data to a server. Not repeatable on authentication failure.url - Path to the resource including protocol and hostnamedataStream - Input sourceIOException - I/O error or HTTP response validation failurevoid put(String url, byte[] data, String contentType) throws IOException
PUT to send data to a server with a specific content type
header. Repeatable on authentication failure.url - Path to the resource including protocol and hostnamedata - Input sourcecontentType - MIME type to add to the HTTP request headerIOException - I/O error or HTTP response validation failurevoid put(String url, InputStream dataStream, String contentType) throws IOException
PUT to send data to a server with a specific content
type header. Not repeatable on authentication failure.url - Path to the resource including protocol and hostnamedataStream - Input sourcecontentType - MIME type to add to the HTTP request headerIOException - I/O error or HTTP response validation failurevoid put(String url, InputStream dataStream, String contentType, boolean expectContinue) throws IOException
PUT to send data to a server with a specific content
type header. Not repeatable on authentication failure.url - Path to the resource including protocol and hostnamedataStream - Input sourcecontentType - MIME type to add to the HTTP request headerexpectContinue - Enable Expect: continue header for PUT requests.IOException - I/O error or HTTP response validation failurevoid put(String url, InputStream dataStream, String contentType, boolean expectContinue, long contentLength) throws IOException
PUT to send data to a server with a specific content
type header. Not repeatable on authentication failure.url - Path to the resource including protocol and hostnamedataStream - Input sourcecontentType - MIME type to add to the HTTP request headerexpectContinue - Enable Expect: continue header for PUT requests.contentLength - data size in bytes to set to Content-Length headerIOException - I/O error or HTTP response validation failurevoid put(String url, InputStream dataStream, Map<String,String> headers) throws IOException
PUT to send data to a server with specific headers. Not repeatable
on authentication failure.url - Path to the resource including protocol and hostnamedataStream - Input sourceheaders - Additional HTTP headers to add to the requestIOException - I/O error or HTTP response validation failurevoid put(String url, File localFile, String contentType) throws IOException
PUT to upload file to a server with specific contentType.
Repeatable on authentication failure.url - Path to the resource including protocol and hostnamelocalFile - local file to sendcontentType - MIME type to add to the HTTP request headerIOException - I/O error or HTTP response validation failurevoid put(String url, File localFile, String contentType, boolean expectContinue) throws IOException
PUT to upload file to a server with specific contentType.
Repeatable on authentication failure.url - Path to the resource including protocol and hostnamelocalFile - local file to sendcontentType - MIME type to add to the HTTP request headerexpectContinue - Enable Expect: continue header for PUT requests.IOException - I/O error or HTTP response validation failurevoid delete(String url) throws IOException
DELETE at the specified urlurl - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failurevoid createDirectory(String url) throws IOException
MKCOL to create a directory at the specified urlurl - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failurevoid move(String sourceUrl, String destinationUrl) throws IOException
MOVE. Assumes overwrite.sourceUrl - Path to the resource including protocol and hostnamedestinationUrl - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failurevoid move(String sourceUrl, String destinationUrl, boolean overwrite) throws IOException
MOVE.sourceUrl - Path to the resource including protocol and hostnamedestinationUrl - Path to the resource including protocol and hostnameoverwrite - true to overwrite if the destination exists, false otherwise.IOException - I/O error or HTTP response validation failurevoid copy(String sourceUrl, String destinationUrl) throws IOException
COPY. Assumes overwrite.sourceUrl - Path to the resource including protocol and hostnamedestinationUrl - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failurevoid copy(String sourceUrl, String destinationUrl, boolean overwrite) throws IOException
COPY.sourceUrl - Path to the resource including protocol and hostnamedestinationUrl - Path to the resource including protocol and hostnameoverwrite - true to overwrite if the destination exists, false otherwise.IOException - I/O error or HTTP response validation failureboolean exists(String url) throws IOException
HEAD request to see if a resource exists or not.url - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failureString lock(String url) throws IOException
Put an exclusive write lock on this resource. A write lock must prevent a principal without the lock from successfully executing a PUT, POST, PROPPATCH, LOCK, UNLOCK, MOVE, DELETE, or MKCOL on the locked resource. All other current methods, GET in particular, function independently of the lock.
A WebDAV compliant server is not required to support locking in any form. If the server does support locking it may choose to support any combination of exclusive and shared locks for any access types.url - Path to the resource including protocol and hostnameLOCK operation in the lockdiscovery property in the response body, and can also be found through
lock discovery on a resource.IOException - I/O error or HTTP response validation failureString refreshLock(String url, String token, String file) throws IOException
url - Path to the resource including protocol and hostnametoken - The lock token used to lock the resourcefile - The name of the file at the end of the urlLOCK operation in the lockdiscovery property in the response body, and can also be found through
lock discovery on a resource.IOException - I/O error or HTTP response validation failurevoid unlock(String url, String token) throws IOException
Unlock the resource.
A WebDAV compliant server is not required to support locking in any form. If the server does support locking it may choose to support any combination of exclusive and shared locks for any access types.url - Path to the resource including protocol and hostnametoken - The lock token to unlock this resource.IOException - I/O error or HTTP response validation failurelock(String)DavAcl getAcl(String url) throws IOException
url - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failureDavQuota getQuota(String url) throws IOException
url - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failurevoid setAcl(String url, List<DavAce> aces) throws IOException
url - Path to the resource including protocol and hostnameaces - Access control elementsIOException - I/O error or HTTP response validation failureList<DavPrincipal> getPrincipals(String url) throws IOException
url - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failureList<String> getPrincipalCollectionSet(String url) throws IOException
url - Path to the resource including protocol and hostnameIOException - I/O error or HTTP response validation failurevoid enableCompression()
Enables HTTP GZIP compression. If enabled, requests originating from Sardine will include "gzip" as an "Accept-Encoding" header.
If the server also supports gzip compression, it should serve the contents in compressed gzip format and include "gzip" as the Content-Encoding. If the content encoding is present, Sardine will automatically decompress the files upon reception.void disableCompression()
enableCompression()void ignoreCookies()
void enablePreemptiveAuthentication(String hostname)
Basic authentication header with each request even before 401 is returned.
Uses default ports: 80 for http and 443 for httpshostname - The hostname to enable preemptive authentication for.void enablePreemptiveAuthentication(URL url)
Basic authentication header with each request even before 401 is returned.url - The hostname, protocol and port to enable preemptive authentication for.void enablePreemptiveAuthentication(String hostname, int httpPort, int httpsPort)
Basic authentication header with each request even before 401 is returned.hostname - The hostname to enable preemptive authentication for.httpPort - The http port to enable preemptive authentication for. -1 for default value.httpsPort - The https port to enable preemptive authentication for. -1 for default value.void disablePreemptiveAuthentication()
void shutdown()
throws IOException
IOExceptionCopyright © 2019. All rights reserved.