mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-08 00:16:09 +00:00
Changes from comments in PR#55
This commit is contained in:
parent
91e4a44157
commit
2f32ffbc1f
@ -32,6 +32,10 @@ import java.util.Locale;
|
|||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import org.apache.jackrabbit.webdav.property.DavPropertyName;
|
||||||
|
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
|
||||||
|
import org.apache.jackrabbit.webdav.xml.Namespace;
|
||||||
|
|
||||||
public class WebdavUtils {
|
public class WebdavUtils {
|
||||||
public static final SimpleDateFormat DISPLAY_DATE_FORMAT = new SimpleDateFormat(
|
public static final SimpleDateFormat DISPLAY_DATE_FORMAT = new SimpleDateFormat(
|
||||||
"dd.MM.yyyy hh:mm");
|
"dd.MM.yyyy hh:mm");
|
||||||
@ -79,4 +83,52 @@ public class WebdavUtils {
|
|||||||
return encodedPath;
|
return encodedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds a DavPropertyNameSet with all prop
|
||||||
|
* For using instead of DavConstants.PROPFIND_ALL_PROP
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static DavPropertyNameSet getAllPropSet(){
|
||||||
|
DavPropertyNameSet propSet = new DavPropertyNameSet();
|
||||||
|
propSet.add(DavPropertyName.DISPLAYNAME);
|
||||||
|
propSet.add(DavPropertyName.GETCONTENTTYPE);
|
||||||
|
propSet.add(DavPropertyName.RESOURCETYPE);
|
||||||
|
propSet.add(DavPropertyName.GETCONTENTLENGTH);
|
||||||
|
propSet.add(DavPropertyName.GETLASTMODIFIED);
|
||||||
|
propSet.add(DavPropertyName.CREATIONDATE);
|
||||||
|
propSet.add(DavPropertyName.GETETAG);
|
||||||
|
propSet.add(DavPropertyName.create(WebdavEntry.PROPERTY_QUOTA_USED_BYTES));
|
||||||
|
propSet.add(DavPropertyName.create(WebdavEntry.PROPERTY_QUOTA_AVAILABLE_BYTES));
|
||||||
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_PERMISSIONS,
|
||||||
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID,
|
||||||
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
|
||||||
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
|
||||||
|
return propSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds a DavPropertyNameSet with properties for files
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static DavPropertyNameSet getFilePropSet(){
|
||||||
|
DavPropertyNameSet propSet = new DavPropertyNameSet();
|
||||||
|
propSet.add(DavPropertyName.DISPLAYNAME);
|
||||||
|
propSet.add(DavPropertyName.GETCONTENTTYPE);
|
||||||
|
propSet.add(DavPropertyName.RESOURCETYPE);
|
||||||
|
propSet.add(DavPropertyName.GETCONTENTLENGTH);
|
||||||
|
propSet.add(DavPropertyName.GETLASTMODIFIED);
|
||||||
|
propSet.add(DavPropertyName.CREATIONDATE);
|
||||||
|
propSet.add(DavPropertyName.GETETAG);
|
||||||
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_PERMISSIONS,
|
||||||
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID,
|
||||||
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
|
||||||
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
|
||||||
|
return propSet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,27 +78,9 @@ public class ReadRemoteFileOperation extends RemoteOperation {
|
|||||||
|
|
||||||
/// take the duty of check the server for the current state of the file there
|
/// take the duty of check the server for the current state of the file there
|
||||||
try {
|
try {
|
||||||
// PropFind Properties ( instead of DavConstants.PROPFIND_ALL_PROP )
|
|
||||||
DavPropertyNameSet propSet = new DavPropertyNameSet();
|
|
||||||
propSet.add(DavPropertyName.DISPLAYNAME);
|
|
||||||
propSet.add(DavPropertyName.GETCONTENTTYPE);
|
|
||||||
propSet.add(DavPropertyName.RESOURCETYPE);
|
|
||||||
propSet.add(DavPropertyName.GETCONTENTLENGTH);
|
|
||||||
propSet.add(DavPropertyName.GETLASTMODIFIED);
|
|
||||||
propSet.add(DavPropertyName.CREATIONDATE);
|
|
||||||
propSet.add(DavPropertyName.GETETAG);
|
|
||||||
propSet.add(DavPropertyName.create(WebdavEntry.PROPERTY_QUOTA_USED_BYTES));
|
|
||||||
propSet.add(DavPropertyName.create(WebdavEntry.PROPERTY_QUOTA_AVAILABLE_BYTES));
|
|
||||||
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_PERMISSIONS,
|
|
||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
|
||||||
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID,
|
|
||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
|
||||||
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
|
|
||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
|
||||||
|
|
||||||
// remote request
|
// remote request
|
||||||
propfind = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath),
|
propfind = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath),
|
||||||
propSet,
|
WebdavUtils.getFilePropSet(), // PropFind Properties
|
||||||
DavConstants.DEPTH_0);
|
DavConstants.DEPTH_0);
|
||||||
int status;
|
int status;
|
||||||
status = client.executeMethod(propfind, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT);
|
status = client.executeMethod(propfind, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT);
|
||||||
|
@ -75,27 +75,9 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
|
|||||||
PropFindMethod query = null;
|
PropFindMethod query = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// PropFind Properties ( instead of DavConstants.PROPFIND_ALL_PROP )
|
|
||||||
DavPropertyNameSet propSet = new DavPropertyNameSet();
|
|
||||||
propSet.add(DavPropertyName.DISPLAYNAME);
|
|
||||||
propSet.add(DavPropertyName.GETCONTENTTYPE);
|
|
||||||
propSet.add(DavPropertyName.RESOURCETYPE);
|
|
||||||
propSet.add(DavPropertyName.GETCONTENTLENGTH);
|
|
||||||
propSet.add(DavPropertyName.GETLASTMODIFIED);
|
|
||||||
propSet.add(DavPropertyName.CREATIONDATE);
|
|
||||||
propSet.add(DavPropertyName.GETETAG);
|
|
||||||
propSet.add(DavPropertyName.create(WebdavEntry.PROPERTY_QUOTA_USED_BYTES));
|
|
||||||
propSet.add(DavPropertyName.create(WebdavEntry.PROPERTY_QUOTA_AVAILABLE_BYTES));
|
|
||||||
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_PERMISSIONS,
|
|
||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
|
||||||
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID,
|
|
||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
|
||||||
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
|
|
||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
|
||||||
|
|
||||||
// remote request
|
// remote request
|
||||||
query = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath),
|
query = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath),
|
||||||
propSet,
|
WebdavUtils.getAllPropSet(), // PropFind Properties
|
||||||
DavConstants.DEPTH_1);
|
DavConstants.DEPTH_1);
|
||||||
int status = client.executeMethod(query);
|
int status = client.executeMethod(query);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user