*** This class provides Binary Compatibility only, not Source Compatibility ***
Class DAVResource
- All Implemented Interfaces:
DAVResourceInterface,Remote
getStatusCode() and getStatusMessage(). For example,
try
{
ConnectionInfo connectionInfo = new ConnectionInfo("http://http-server/path-to-resource",
"user",
"pwd");
// proxy information, if required
connectionInfo.setProxyHost("myproxy.com");
connectionInfo.setProxyPort(3100);
DAVResource davResource1 = new DAVResource(connectionInfo);
int httpStatusCode = davResource1.getStatusCode();
if (HttpStatus.SC_NOT_FOUND == httpStatusCode)
{
// DAV resource was not found
}
davResource1.setProperty(...);
if (HttpStatus.SC_OK != davResource1.getStatusCode())
{
out.println(davResource1.getStatusMessage());
}
}
catch (DAVException e)
{
// handle the exception
}
In order to create a collection use the longer form of the constructor. For example,
DAVResource davResource2 = new DAVResource(connectionInfo, true);
int httpStatusCode = davResource2.getStatusCode();
if (HttpStatus.SC_NOT_FOUND == httpStatusCode)
{
// DAV resource was not found
}
This will ensure that davResource2 is a collection resource (it may contain other resources). Alternatively, do this in two steps
DAVResource davResource2 = new DAVResource(connectionInfo);
int httpStatusCode = davResource2.getStatusCode();
if (HttpStatus.SC_NOT_FOUND == httpStatusCode)
{
// DAV resource was not found
}
davResource2.makeCollection();
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConnectionInfoConnection information.static final intstatic final intThe default port for HTTP is80.static final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionDAVResource(ConnectionInfo cInfo) Creates a DAVResource using the connection information.DAVResource(ConnectionInfo cInfo, boolean createCollection) DAVResource(String url) Creates a DAVResource using a string URL.DAVResource(String url, boolean createCollection) Creates a DAVResource using a string URL and boolean flag to indicate whether a collection should be created.DAVResource(String url, String userName, String password) Creates a DAVResource using a string URL, userName and password.DAVResource(URL url) Creates a DAVResource using a Java URL. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the socket used for this connection.org.apache.http.entity.ContentTypeGets the Apache HTTP entity content type of the content for this DAV resource.copy(String targetPath) Copies resource to the target destination.voiddelete()Deletes this DAV resource.voidCheck in this DAV resource.voidChecks out this DAV resource.voidPuts the resource under version control.voiddoLabel(int labelAction, String label) Modifies the version label on the resource (if this is supported by the server).voiddoLabel(int labelAction, String label, int depth) Modifies the label on the version resource (if this is supported by the server).PropertiesGets the options as Properties representing the header name/value pairs.doReport(org.apache.jackrabbit.webdav.version.report.ReportInfo reportInfo) Gets a report on the current DAV resource.doSearch(org.apache.jackrabbit.webdav.search.SearchInfo searchInfo) The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query.voidUncheckout this DAV resource, canceling a previous checkout.booleanexists()Returns whether the resource exists.static StringextractPath(String url) Extract the path (query and fragment identifier from a URL).AclgetAcl()Gets the access control list for this DAV resource.StringgetACL()Gets the access control list (ACL) for this DAV resource.String[]Returns a list of methods allowed on this resource.VersionRetrieves the currently checked in resource.VersionRetrieves the currently checked out resource.List<String> getChildrenList(String path) Gets the list of children.Map<String, PropertyMap> getChildrenProperties(PropertyName[] properties) Get all the properties of a collection's members (depth=1) in as single server request.byte[]Gets the contents of this DAV resource as a byte array.voidgetContents(File fileData) Gets the content of this DAV resource into a file specified as the parameter.StringGets the contents of this DAV resource as a String.InputStreamGets the content of this DAV resource as a stream.StringGets the content type of the content for this DAV resource.String[]Returns a list of DAV capabilities.Gets all of the DAV resource's properties using the resource's depth.getDavProperties(int depth) Gets all of the DAV resource's properties for the specified depth.getDavProperties(PropertyName[] propertyNames) Gets all the properties for the specified property names on the DAV resource.getDavProperties(PropertyName[] propertyNames, int depth) Gets all the properties for the specified property names on the DAV resource.getDavProperties(org.apache.jackrabbit.webdav.property.DavPropertyNameSet davPropertyNameSet, int depth) Gets the properties for the specified DAV property names and search depth.Gets DAV properties for all of a DAV resource's property names.getDavPropertyNames(int depth) Gets DAV properties for all of a DAV resource's property names for the specified depth.intgetDepth()Gets the value for depth.intGets the existence requirement.StringgetLock(String userName) Gets this DAV resource's lock token for the specified user.MapReturns the multiple status information for the last operation.booleanGets the overwrite flag which specifies whether this DAV resource can be overwritten.StringgetPath()Gets the path for the WebDAV resource that is currently represented by this DAVResource.ListGets a list of previous version names for this DAV resource.Returns a property map of the resources properties.intGets the HTTP status code for the last operation/method.StringGets the message associated with the status code for the last operation/method.StringReturns the current setting for the directory for temporary files.URLgetURL()Gets the URL that this DAV resource represents.VersiongetVersion(String versionName) Gets a particular version of this DAV resource.protected booleanReturns whether a password is required to connect to this serverbooleanIs this DAV resource a collection?booleanisLocked()Is this DAV resource locked?Stringlock()Locks this DAV resource.booleanMakes a collection.move(String targetPath) Moves this DAV resource to the location given in the parameter.voidremoveProperties(PropertyName[] propertyNames) Removes the properties specified in the parameter.voidremoveProperties(Element[] propNames) Removes the properties specified in the parameter.voidremoveProperty(PropertyName propName) Removes the property specified in the parameter.voidremoveProperty(String propName) Removes the property specified in the parameter.voidremoveProperty(Element propName) Removes the property specified in the parameter.StringsetAcl(Acl acl) Sets the access control list for this DAV resource.StringsetACL(String acl) Set/Update the Access Control List for this DAV resource.voidsetContents(byte[] contents) Sets the contents of the resource, passing in a byte array.voidsetContents(InputStream is) Sets the contents of the resource from an input stream.voidsetContents(String content) Sets the contents of the resource, passing in a URL.voidsetContents(URL url) Sets the contents of the resource, passing in a URL.voidsetContentType(String contentType) Sets the contents type for the content of the resource.voidsetCredentialsProvider(org.apache.http.client.CredentialsProvider credentialsProvider) Sets a credentials provider.voidsetDebug(int debug) Set the value for debug.voidsetDepth(int depth) Set the value for depth.voidsetExistsRequirement(int requirement) Sets the existence requirement.voidsetOverwrite(boolean overwrite) Sets the overwrite flag which specifies whether this DAV resource can be overwritten.voidsetPassword(String password) Set the value for password.voidsetPath(String path) Sets the path for this DAV resource.voidsetProperties(PropertyName[] propNames, String[] propValues) Sets the values of properties, as given in the parameter.voidsetProperties(DocumentFragment props) Sets the values of properties, as given in the parameter.voidsetProperties(Element[] elems) Sets the values of properties, as given in the parameter.voidsetProperty(PropertyName propName, String propValue) Sets the value of a property, as given in the parameter.voidsetProperty(Element prop) Sets the value of a property, as given in the parameter.voidsetTempDir(String tempDir) Provides a way to set a directory for temporary files.voidsetUserName(String userName) Set the value for userName.booleanReturns whether the last method was successful or not.protected static booleanSUCCEEDED(int statusCode) static StringunencodePath(String path) Unencode the path.voidunlock()Unlocks the resource, if previously locked by the same principal.voidunlock(String lockToken) Unlocks the resource, with the correctlocktoken.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
HTTP_DEFAULT_PORT
public static final int HTTP_DEFAULT_PORTThe default port for HTTP is80.- See Also:
-
_connectionInfo
Connection information. -
DONT_CARE
public static final int DONT_CARE- See Also:
-
MUST_EXIST
public static final int MUST_EXIST- See Also:
-
MUST_NOT_EXIST
public static final int MUST_NOT_EXIST- See Also:
-
-
Constructor Details
-
DAVResource
Creates a DAVResource using a string URL.Note that one should check the HTTP status code (e.g.
HttpStatus.SC_NOT_FOUND) after invoking this constructor since aDAVExceptionis not thrown for all exceptions.- Parameters:
url- URL for the resource.- Throws:
DAVException- if a DAV Server error occurs.
-
DAVResource
Creates a DAVResource using a string URL, userName and password.Note that one should check the HTTP status code (e.g.
HttpStatus.SC_NOT_FOUND) after invoking this constructor since aDAVExceptionis not thrown for all exceptions.- Parameters:
url- URL for the resourceuserName- authentication user namepassword- password for authentication- Throws:
DAVException- if a DAV Server error occurs.
-
DAVResource
Creates a DAVResource using a Java URL.Note that one should check the HTTP status code (e.g.
HttpStatus.SC_NOT_FOUND) after invoking this constructor since aDAVExceptionis not thrown for all exceptions.- Parameters:
url- URL for the resource- Throws:
DAVException- if a DAV Server error occurs.
-
DAVResource
Creates a DAVResource using a string URL and boolean flag to indicate whether a collection should be created.Note that one should check the HTTP status code (e.g.
HttpStatus.SC_NOT_FOUND) after invoking this constructor since aDAVExceptionis not thrown for all exceptions.- Parameters:
url- URL for the resourcecreateCollection- The URL indicates a collection resource- Throws:
DAVException- if a DAV Server error occurs.
-
DAVResource
Creates a DAVResource using the connection information. For internal use only.Note that one should check the HTTP status code (e.g.
HttpStatus.SC_NOT_FOUND) after invoking this constructor since aDAVExceptionis not thrown for all exceptions.- Parameters:
cInfo- The connection information for the resource- Throws:
DAVException- if a DAV Server error occurs.
-
DAVResource
- Throws:
DAVException
-
-
Method Details
-
setCredentialsProvider
public void setCredentialsProvider(org.apache.http.client.CredentialsProvider credentialsProvider) Description copied from interface:DAVResourceInterfaceSets a credentials provider. When authentication has failed, the credentials provider is called to provide a set of credentials for authentication. This allows an external agent to provide credentials when original credentials no longer work e.g. one-time passwords.- Specified by:
setCredentialsProviderin interfaceDAVResourceInterface
-
makeCollection
Makes a collection. This method only works on a null resource (one that doesn't exist yet). One would normally call this method immediately after creating this DAVResource.- Specified by:
makeCollectionin interfaceDAVResourceInterface- Returns:
- boolean True is make collection successful, false otherwise.
- Throws:
DAVException- in the case of a WebDAV error.
-
copy
Copies resource to the target destination.- Specified by:
copyin interfaceDAVResourceInterface- Parameters:
targetPath- location to which current resource is to be copied.- Returns:
- If successful, then a new DAVResource representing the new destination is created and returned.
- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.
-
delete
Deletes this DAV resource.- Specified by:
deletein interfaceDAVResourceInterface- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
getLock
Gets this DAV resource's lock token for the specified user.- Parameters:
userName- Name of the user whose lock token is desired for this DAV resource.- Returns:
- Lock token or
nullif the specified user does not own the lock for this DAV resource. - Throws:
DAVException- if an error is encountered.
-
getContents
Gets the contents of this DAV resource as a byte array.- Specified by:
getContentsin interfaceDAVResourceInterface- Returns:
- byte[] The contents of the resource as a byte array
- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
getContentsAsString
Gets the contents of this DAV resource as a String.- Specified by:
getContentsAsStringin interfaceDAVResourceInterface- Returns:
- String representation of the contents of this DAV resource.
- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
getContents
Gets the content of this DAV resource into a file specified as the parameter.- Specified by:
getContentsin interfaceDAVResourceInterface- Parameters:
fileData- The file into which the contents of the resource should be written.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
getContentsInputStream
Gets the content of this DAV resource as a stream.- Specified by:
getContentsInputStreamin interfaceDAVResourceInterface- Returns:
- InputStream The stream representing the content of the resource.
- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
getContentType
public String getContentType()Gets the content type of the content for this DAV resource.- Specified by:
getContentTypein interfaceDAVResourceInterface- Returns:
- String The content type for this DAV resource
- See Also:
-
contentType
public org.apache.http.entity.ContentType contentType()Gets the Apache HTTP entity content type of the content for this DAV resource.- Specified by:
contentTypein interfaceDAVResourceInterface- Returns:
- Apache HTTP entity content type of the content for this DAV resource or
nullif no MIME type has been specified. - See Also:
-
getDavProperties
Gets all of the DAV resource's properties using the resource's depth.- Specified by:
getDavPropertiesin interfaceDAVResourceInterface- Returns:
DavPropertyResultwhich has the DAV properties which were returned by the property find method.- Throws:
DAVException- in the case of server failures.RemoteException- in the case of network failures.- See Also:
-
getDavProperties
Gets all of the DAV resource's properties for the specified depth.- Specified by:
getDavPropertiesin interfaceDAVResourceInterface- Parameters:
depth- The depth on which DAV operations will be based. Specify one ofDavConstants.DEPTH_0orDavConstants.DEPTH_1orDavConstants.DEPTH_INFINITY.- Returns:
DavPropertyResultwhich has the DAV properties which were returned by the property find method.- Throws:
DAVException- in the case of server failures.RemoteException- in the case of network failures.- See Also:
-
getDavProperties
public DavPropertyResult getDavProperties(PropertyName[] propertyNames) throws DAVException, RemoteException Gets all the properties for the specified property names on the DAV resource.- Specified by:
getDavPropertiesin interfaceDAVResourceInterface- Parameters:
propertyNames- Array of property names, specifying which properties should be returned.- Returns:
DavPropertyResultwhich has the DAV properties which were returned by the property find method.- Throws:
DAVException- in the case of server failures.RemoteException- in the case of network failures.
-
getDavProperties
public DavPropertyResult getDavProperties(PropertyName[] propertyNames, int depth) throws DAVException, RemoteException Gets all the properties for the specified property names on the DAV resource.- Specified by:
getDavPropertiesin interfaceDAVResourceInterface- Parameters:
propertyNames- Array of property names, specifying which properties should be returned.depth- The depth on which DAV operations will be based. Specify one ofDavConstants.DEPTH_0orDavConstants.DEPTH_1orDavConstants.DEPTH_INFINITY.- Returns:
DavPropertyResultwhich has the DAV properties which were returned by the property find method.- Throws:
DAVException- in the case of server failures.RemoteException- in the case of network failures.
-
getDavProperties
public DavPropertyResult getDavProperties(org.apache.jackrabbit.webdav.property.DavPropertyNameSet davPropertyNameSet, int depth) throws DAVException, RemoteException Gets the properties for the specified DAV property names and search depth.- Specified by:
getDavPropertiesin interfaceDAVResourceInterface- Parameters:
davPropertyNameSet- Set of the names of the DAV properties which should be returned.depth- The depth on which DAV operations will be based. Specify one ofDavConstants.DEPTH_0orDavConstants.DEPTH_1orDavConstants.DEPTH_INFINITY.- Returns:
DavPropertyResultwhich has the DAV properties which were returned by the property find method.- Throws:
DAVException- in the case of server failures.RemoteException- in the case of network failures.
-
getDavPropertyNames
Gets DAV properties for all of a DAV resource's property names.- Specified by:
getDavPropertyNamesin interfaceDAVResourceInterface- Returns:
DavPropertyResultwhich has the DAV properties which were returned by the property find method.- Throws:
DAVException- in the case of server failures.RemoteException- in the case of network failures.- See Also:
-
getDavPropertyNames
Gets DAV properties for all of a DAV resource's property names for the specified depth.- Specified by:
getDavPropertyNamesin interfaceDAVResourceInterface- Parameters:
depth-- Returns:
DavPropertyResultwhich has the DAV properties which were returned by the property find method.- Throws:
DAVException- in the case of server failures.RemoteException- in the case of network failures.- See Also:
-
getStatusCode
Gets the HTTP status code for the last operation/method.- Specified by:
getStatusCodein interfaceDAVResourceInterface- Returns:
- The HTTP status code for the last request on this DAV resource.
- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
getStatusMessage
public String getStatusMessage()Gets the message associated with the status code for the last operation/method.- Specified by:
getStatusMessagein interfaceDAVResourceInterface- Returns:
- The status message for the last request on this DAV resource.
-
getURL
Gets the URL that this DAV resource represents.- Specified by:
getURLin interfaceDAVResourceInterface- Returns:
- The URL for this DAV resource.
- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
isCollection
Is this DAV resource a collection?- Specified by:
isCollectionin interfaceDAVResourceInterface- Returns:
trueif it is a collection,falseotherwise.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
isLocked
Is this DAV resource locked?- Specified by:
isLockedin interfaceDAVResourceInterface- Returns:
trueif it is locked,falseotherwise.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
lock
Locks this DAV resource.- Specified by:
lockin interfaceDAVResourceInterface- Returns:
- The lock token if the resource is successfully locked.
- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
move
Moves this DAV resource to the location given in the parameter.- Specified by:
movein interfaceDAVResourceInterface- Parameters:
targetPath- The destination URL for this copy.- Returns:
- A DAVResource that represents the new resource.
- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
removeProperties
Removes the properties specified in the parameter.- Specified by:
removePropertiesin interfaceDAVResourceInterface- Parameters:
propertyNames- An array of property names that should be removed.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
removeProperties
Removes the properties specified in the parameter.- Specified by:
removePropertiesin interfaceDAVResourceInterface- Parameters:
propNames- An array of property names that should be removed.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
removeProperty
Removes the property specified in the parameter.- Specified by:
removePropertyin interfaceDAVResourceInterface- Parameters:
propName- The name of a property that should be removed from this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
removeProperty
Removes the property specified in the parameter.- Specified by:
removePropertyin interfaceDAVResourceInterface- Parameters:
propName- The name of a property that should be removed from this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
removeProperty
Removes the property specified in the parameter.- Specified by:
removePropertyin interfaceDAVResourceInterface- Parameters:
propName- The name of a property that should be removed from this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
doSearch
public DavPropertyResult doSearch(org.apache.jackrabbit.webdav.search.SearchInfo searchInfo) throws DAVException, RemoteException The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query.- Specified by:
doSearchin interfaceDAVResourceInterface- Parameters:
searchInfo- The search criteria.- Returns:
DavPropertyResultwhich has the DAV properties which were returned by the property find method.- Throws:
DAVException- in the case of server failures.RemoteException- in the case of network failures.
-
setContents
Sets the contents of the resource, passing in a byte array.- Specified by:
setContentsin interfaceDAVResourceInterface- Parameters:
contents- The byte array containing the content for this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
setContents
Sets the contents of the resource, passing in a URL.- Specified by:
setContentsin interfaceDAVResourceInterface- Parameters:
url- A URL that represents the content for this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
setContents
Sets the contents of the resource, passing in a URL.- Specified by:
setContentsin interfaceDAVResourceInterface- Parameters:
content- The string containing the content for this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
setContents
Sets the contents of the resource from an input stream. For remote deployment the InputStream should be wrapped in anInputStreamAdapter.- Specified by:
setContentsin interfaceDAVResourceInterface- Parameters:
is- An input stream representing the content for this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
setContentType
Sets the contents type for the content of the resource.- Specified by:
setContentTypein interfaceDAVResourceInterface- Parameters:
contentType- The content type for this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.- See Also:
-
setProperties
Sets the values of properties, as given in the parameter.- Specified by:
setPropertiesin interfaceDAVResourceInterface- Parameters:
elems- An array of properties to be set on this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
setProperties
public void setProperties(PropertyName[] propNames, String[] propValues) throws DAVException, RemoteException Sets the values of properties, as given in the parameter.- Specified by:
setPropertiesin interfaceDAVResourceInterface- Parameters:
propNames- An array of property names to be set on this DAV resource.propValues- An array of property values to be set on this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
setProperties
Sets the values of properties, as given in the parameter.- Specified by:
setPropertiesin interfaceDAVResourceInterface- Parameters:
props- An XML document fragment that defines the properties to be set on this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
setProperty
public void setProperty(PropertyName propName, String propValue) throws DAVException, RemoteException Sets the value of a property, as given in the parameter.- Specified by:
setPropertyin interfaceDAVResourceInterface- Parameters:
propName- An property name to be set on this DAV resource.propValue- A property value to be set on this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
setProperty
Sets the value of a property, as given in the parameter.- Specified by:
setPropertyin interfaceDAVResourceInterface- Parameters:
prop- An XML element that represents a property to be set on this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
unlock
Unlocks the resource, if previously locked by the same principal.- Specified by:
unlockin interfaceDAVResourceInterface- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
unlock
Unlocks the resource, with the correctlocktoken.- Specified by:
unlockin interfaceDAVResourceInterface- Parameters:
lockToken- The lock token for this DAV resource.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
getOverwrite
public boolean getOverwrite()Gets the overwrite flag which specifies whether this DAV resource can be overwritten.- Specified by:
getOverwritein interfaceDAVResourceInterface- Returns:
trueif the overwrite flag is set,falseotherwise
-
setOverwrite
public void setOverwrite(boolean overwrite) Sets the overwrite flag which specifies whether this DAV resource can be overwritten.- Specified by:
setOverwritein interfaceDAVResourceInterface- Parameters:
overwrite- The value of the overwrite flag to set on the resource.
-
setUserName
public void setUserName(String userName) Set the value for userName. Used in authentication requests to the server- Parameters:
userName- user name
-
setPassword
public void setPassword(String password) Set the value for password. Used in authentication requests to the server- Parameters:
password- password
-
setDebug
public void setDebug(int debug) Set the value for debug.- Parameters:
debug- The debug setting
-
setDepth
Set the value for depth. This is the depth on which DAV operations will be based. They can be one of three values:DavConstants.DEPTH_0DavConstants.DEPTH_1DavConstants.DEPTH_INFINITY
- Specified by:
setDepthin interfaceDAVResourceInterface- Parameters:
depth- The depth on which DAV operations will be based. Specify one ofDavConstants.DEPTH_0orDavConstants.DEPTH_1orDavConstants.DEPTH_INFINITY.- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.
-
getDepth
public int getDepth()Gets the value for depth. This is the depth on which DAV operations will be based. They can be one of three values:DavConstants.DEPTH_0DavConstants.DEPTH_1DavConstants.DEPTH_INFINITY
- Specified by:
getDepthin interfaceDAVResourceInterface- Returns:
- The depth on which DAV operations will be based.
-
doOptions
Gets the options as Properties representing the header name/value pairs. The DAVstatus,allowedMethodsanddavCapabilitiesare also updated.- Returns:
- Properties keyed by a header name to its value.
- Throws:
DAVException- if unable to get the DAV options.RemoteException- if a communications-related exception occurs.
-
getAllowedMethods
public String[] getAllowedMethods()Returns a list of methods allowed on this resource.- Returns:
- String[] - list of methods allowed on this resource
-
getDavCapabilities
public String[] getDavCapabilities()Returns a list of DAV capabilities. The DAV header provides information on what DAV functions are supported by the server. Basic DAV support requires the DAV header and a value of "1", but support for locking features would have a value "1,2" for the DAV header. Further capabilities will be added in the future (e.g. access-control). The DAV header is a comma delimited list of capabilities, returned as items in a string array.- Returns:
- String[] - DAV capabilities supported by the server
-
isAuthReqd
protected boolean isAuthReqd()Returns whether a password is required to connect to this server- Returns:
- boolean - true if authentication credentials are required for a connection, false otherwise
-
SUCCEEDED
public boolean SUCCEEDED() throws RemoteExceptionReturns whether the last method was successful or not. The HTTP status codes in the range 200-299 are successful. All others indicate some sort of unsuccessful attempt.- Specified by:
SUCCEEDEDin interfaceDAVResourceInterface- Returns:
trueif last method was successful,falseotherwise.- Throws:
RemoteException- in the case of network failures.
-
SUCCEEDED
protected static boolean SUCCEEDED(int statusCode) -
getMultiStatus
public Map getMultiStatus()Returns the multiple status information for the last operation.- Returns:
- Map (href to propstat) Multistatus response from the last DAV method.
-
close
public void close() throws RemoteExceptionCloses the socket used for this connection. This can be useful for servers that have a limit on the number of connections (e.g. IIS), and provides a way to control network resources.- Specified by:
closein interfaceDAVResourceInterface- Throws:
RemoteException- in the event of network failure.
-
setTempDir
public void setTempDir(String tempDir) throws RemoteException Provides a way to set a directory for temporary files. Thejava.io.tmpsystem property can be used to set this value at JVM invocation. If the system property is not set "/temp/" is the default, but can be overridden with this method.- Specified by:
setTempDirin interfaceDAVResourceInterface- Parameters:
tempDir- Temporary directory for temporary files.- Throws:
RemoteException- in the event of network failure.
-
getTempDir
public String getTempDir() throws RemoteExceptionReturns the current setting for the directory for temporary files.- Specified by:
getTempDirin interfaceDAVResourceInterface- Returns:
- The temporary directory for temporary files.
- Throws:
RemoteException- in the event of network failure.
-
exists
public boolean exists() throws RemoteExceptionReturns whether the resource exists.- Specified by:
existsin interfaceDAVResourceInterface- Returns:
trueif resource exists,falseotherwise.- Throws:
RemoteException- in the event of network failure.
-
doReport
public DavPropertyResult doReport(org.apache.jackrabbit.webdav.version.report.ReportInfo reportInfo) throws DAVException Gets a report on the current DAV resource. TheReportInfoparameter specifies the following information.- report type
- depth
- property names
- Specified by:
doReportin interfaceDAVResourceInterface- Parameters:
reportInfo- Information which specifies the desired report.- Returns:
DavPropertyResultwhich has the DAV properties which were returned by the property report method.- Throws:
DAVException- in the case of server failures.
-
getACL
Gets the access control list (ACL) for this DAV resource.- Specified by:
getACLin interfaceDAVResourceInterface- Returns:
- String An XML serialized document describing the ACL for this DAV resource.
- Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.- See Also:
-
getAcl
Gets the access control list for this DAV resource.- Specified by:
getAclin interfaceDAVResourceInterface- Returns:
- The access control list for this DAV resource.
- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.- See Also:
-
setACL
Set/Update the Access Control List for this DAV resource.- Specified by:
setACLin interfaceDAVResourceInterface- Parameters:
acl- An XML serialized document describing the ACL for this DAV resource.- Returns:
- Document The result document from the ACL method or
nullif there was no response document. - Throws:
DAVException- in the event of a WebDAV failure.RemoteException- in the event of network failure.- See Also:
-
setAcl
Sets the access control list for this DAV resource.- Specified by:
setAclin interfaceDAVResourceInterface- Parameters:
acl- The access control list to set for this DAV resource.- Returns:
- The string representation of the access control list or
nullif there was no response document. - Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.- See Also:
-
setPath
public void setPath(String path) Sets the path for this DAV resource. If the resource was originally created as http://server/origpath, then calling this method will change the resource path to http://server/path. This allows the same DAVResource object to be used for any WebDAV resource.- Specified by:
setPathin interfaceDAVResourceInterface- Parameters:
path- The new path for the WebDAV resource.
-
getPath
public String getPath()Gets the path for the WebDAV resource that is currently represented by this DAVResource.- Specified by:
getPathin interfaceDAVResourceInterface- Returns:
- The current path for this DAV resource.
-
doControl
Puts the resource under version control.- Specified by:
doControlin interfaceDAVResourceInterface- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.
-
getPreviousVersionNames
Gets a list of previous version names for this DAV resource.- Specified by:
getPreviousVersionNamesin interfaceDAVResourceInterface- Returns:
- List(String) The version names for this DAV resource.
- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.
-
doCheckout
Checks out this DAV resource.- Specified by:
doCheckoutin interfaceDAVResourceInterface- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.
-
doLabel
Modifies the version label on the resource (if this is supported by the server).- Specified by:
doLabelin interfaceDAVResourceInterface- Parameters:
labelAction- Specifies the action which is to be executed.- LabelInfo#TYPE_SET
- LabelInfo#TYPE_REMOVE
- LabelInfo#TYPE_ADD
label- The value of the label.- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.- See Also:
-
doLabel
Modifies the label on the version resource (if this is supported by the server).- Specified by:
doLabelin interfaceDAVResourceInterface- Parameters:
labelAction- Specifies the action which is to be executed.- LabelInfo#TYPE_SET
- LabelInfo#TYPE_REMOVE
- LabelInfo#TYPE_ADD
label- The value of the label.depth- The depth.- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.- See Also:
-
doCheckin
Check in this DAV resource.- Specified by:
doCheckinin interfaceDAVResourceInterface- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.
-
doUncheckout
Uncheckout this DAV resource, canceling a previous checkout.- Specified by:
doUncheckoutin interfaceDAVResourceInterface- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.
-
getCheckedIn
Retrieves the currently checked in resource.- Specified by:
getCheckedInin interfaceDAVResourceInterface- Returns:
- Version An object describing the version that is checked in.
- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.
-
getCheckedOut
Retrieves the currently checked out resource.- Specified by:
getCheckedOutin interfaceDAVResourceInterface- Returns:
- Version An object describing the version that is checked out.
- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of network failures.
-
getVersion
Gets a particular version of this DAV resource.- Specified by:
getVersionin interfaceDAVResourceInterface- Parameters:
versionName- Which version to retrieve for this DAV resource.- Returns:
- Version An object describing the version of this DAV resource.
- Throws:
DAVException- in the case of a WebDAV error.
-
setExistsRequirement
public void setExistsRequirement(int requirement) Sets the existence requirement.- Specified by:
setExistsRequirementin interfaceDAVResourceInterface- Parameters:
requirement-0if we don't care or1if it must exist or2if it must not exist.
-
getExistsRequirement
public int getExistsRequirement()Gets the existence requirement.- Specified by:
getExistsRequirementin interfaceDAVResourceInterface- Returns:
0if we don't care or1if it must exist or2if it must not exist.
-
getChildrenList
public List<String> getChildrenList(String path) Gets the list of children. If this is not a collection, or is an empty collection the returned list will be empty. Otherwise, it will contain the path for each child in the collection.- Specified by:
getChildrenListin interfaceDAVResourceInterface- Parameters:
path- The path of this DAV resource.- Returns:
- List (of String) The paths for the children.
-
getChildrenProperties
public Map<String,PropertyMap> getChildrenProperties(PropertyName[] properties) throws DAVException, RemoteException Get all the properties of a collection's members (depth=1) in as single server request. This does not bind to each one of the items in the collection and is a quick way to find out what items are in the collection without fetching each one.- Returns:
- Map (maps String representation of a URL to (Map of String property name to its String value)) which is the property map for all the items in this collection.
- Throws:
DAVException- in the case of a WebDAV error.RemoteException- in the case of a network error.
-
extractPath
public static String extractPath(String url) Extract the path (query and fragment identifier from a URL). This method does not use the URL/URI classes and simply scans for the right location of the beginning of the path.- Parameters:
url- The URL from which the path should be extracted- Returns:
- String Everything after the beginning of the path in the supplied URL.
-
unencodePath
public static String unencodePath(String path) Unencode the path.- Parameters:
path- The URL from which the path should be extracted.- Returns:
- String Everything after the beginning of the path in the supplied URL.
-
getPropertyMap
Returns a property map of the resources properties.- Returns:
- PropertyMap A map containing the properties for this resource
- Throws:
DAVException- in the event of WebDAV errorsRemoteException- in the case of network errors
-