1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Revert "Allow conditional read of list of files in a folder based on ETag"; server does not work that way

This reverts commit 5ff9062ea8fefb1bf2b3952b9d64daa4f9922a39.
This commit is contained in:
David A. Velasco 2016-11-22 17:04:33 +01:00
parent b87d2c9e7c
commit 67d7217d13
2 changed files with 32 additions and 52 deletions

View File

@ -62,7 +62,7 @@ import javax.net.ssl.SSLException;
public class RemoteOperationResult implements Serializable {
/** Generated - should be refreshed every time the class changes!! */;
private static final long serialVersionUID = -1909603208238358633L;
private static final long serialVersionUID = 1129130415603799707L;
private static final String TAG = RemoteOperationResult.class.getSimpleName();
@ -112,8 +112,7 @@ public class RemoteOperationResult implements Serializable {
WRONG_SERVER_RESPONSE,
INVALID_CHARACTER_DETECT_IN_SERVER,
DELAYED_FOR_WIFI,
LOCAL_FILE_NOT_FOUND,
NOT_MODIFIED
LOCAL_FILE_NOT_FOUND
}
private boolean mSuccess = false;
@ -161,8 +160,6 @@ public class RemoteOperationResult implements Serializable {
case HttpStatus.SC_FORBIDDEN:
mCode = ResultCode.FORBIDDEN;
break;
case HttpStatus.SC_NOT_MODIFIED:
mCode = ResultCode.NOT_MODIFIED;
default:
mCode = ResultCode.UNHANDLED_HTTP_CODE;
Log_OC.d(TAG, "RemoteOperationResult has processed UNHANDLED_HTTP_CODE: " +
@ -413,9 +410,6 @@ public class RemoteOperationResult implements Serializable {
} else if (mCode == ResultCode.SYNC_CONFLICT) {
return "Synchronization conflict";
} else if (mCode == ResultCode.NOT_MODIFIED) {
return "Resource in server was not modified";
}
return "Operation finished with HTTP status code " + mHttpCode + " (" +

View File

@ -49,10 +49,7 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
private static final String TAG = ReadRemoteFolderOperation.class.getSimpleName();
private static final String IF_NONE_MATCH_HEADER = "If-None-Match";
private String mRemotePath;
private String mETagToNotMatch;
private ArrayList<Object> mFolderAndFiles;
/**
@ -62,17 +59,6 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
*/
public ReadRemoteFolderOperation(String remotePath) {
mRemotePath = remotePath;
mETagToNotMatch = "";
}
/**
* Constructor
*
* @param remotePath Remote path of the file.
*/
public ReadRemoteFolderOperation(String remotePath, String eTagToNotMatch) {
mRemotePath = remotePath;
mETagToNotMatch = (eTagToNotMatch == null) ? "" : eTagToNotMatch;
}
/**
@ -90,10 +76,6 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
query = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath),
WebdavUtils.getAllPropSet(), // PropFind Properties
DavConstants.DEPTH_1);
if (mETagToNotMatch.length() > 0) {
query.addRequestHeader(IF_NONE_MATCH_HEADER, "\"" + mETagToNotMatch + "\"");
}
int status = client.executeMethod(query);
// check and process response
@ -113,7 +95,7 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
result.setData(mFolderAndFiles);
}
} else {
// synchronization failed, or no change in folder (mETagToNotMatch matched)
// synchronization failed
client.exhaustResponse(query.getResponseBodyAsStream());
result = new RemoteOperationResult(false, status, query.getResponseHeaders());
}
@ -140,6 +122,10 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
return result;
}
public boolean isMultiStatus(int status) {
return (status == HttpStatus.SC_MULTI_STATUS);
}
/**
* Read the data retrieved from the server about the contents of the target folder
*