mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Added OCS-APIREQUEST header to every OCS request
This commit is contained in:
parent
cd4414a7bd
commit
bb950b7483
@ -48,6 +48,10 @@ public class CreateRemoteShareOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = CreateRemoteShareOperation.class.getSimpleName();
|
||||
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
private static final String PARAM_PATH = "path";
|
||||
private static final String PARAM_SHARE_TYPE = "shareType";
|
||||
private static final String PARAM_SHARE_WITH = "shareWith";
|
||||
@ -115,6 +119,8 @@ public class CreateRemoteShareOperation extends RemoteOperation {
|
||||
}
|
||||
post.addParameter(PARAM_PERMISSIONS, Integer.toString(mPermissions));
|
||||
|
||||
post.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
|
||||
|
||||
status = client.executeMethod(post);
|
||||
|
||||
if(isSuccess(status)) {
|
||||
|
@ -52,6 +52,10 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = GetRemoteSharesForFileOperation.class.getSimpleName();
|
||||
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
private static final String PARAM_PATH = "path";
|
||||
private static final String PARAM_RESHARES = "reshares";
|
||||
private static final String PARAM_SUBFILES = "subfiles";
|
||||
@ -96,6 +100,8 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation {
|
||||
new NameValuePair(PARAM_SUBFILES, String.valueOf(mSubfiles))
|
||||
});
|
||||
|
||||
get.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
|
||||
|
||||
status = client.executeMethod(get);
|
||||
|
||||
if(isSuccess(status)) {
|
||||
|
@ -50,6 +50,10 @@ public class GetRemoteSharesOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = GetRemoteSharesOperation.class.getSimpleName();
|
||||
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
private ArrayList<OCShare> mShares; // List of shares for result
|
||||
|
||||
|
||||
@ -68,6 +72,7 @@ public class GetRemoteSharesOperation extends RemoteOperation {
|
||||
try{
|
||||
get = new GetMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH);
|
||||
Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH);
|
||||
get.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
|
||||
status = client.executeMethod(get);
|
||||
if(isSuccess(status)) {
|
||||
Log.d(TAG, "Obtain RESPONSE");
|
||||
|
@ -48,6 +48,10 @@ public class RemoveRemoteShareOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = RemoveRemoteShareOperation.class.getSimpleName();
|
||||
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
private int mRemoteShareId;
|
||||
|
||||
/**
|
||||
@ -73,6 +77,8 @@ public class RemoveRemoteShareOperation extends RemoteOperation {
|
||||
delete = new DeleteMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH + id);
|
||||
Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH + id);
|
||||
|
||||
delete.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
|
||||
|
||||
status = client.executeMethod(delete);
|
||||
|
||||
if(isSuccess(status)) {
|
||||
|
@ -48,7 +48,7 @@ public class GetRemoteUserNameOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = GetRemoteUserNameOperation.class.getSimpleName();
|
||||
|
||||
// HEADER
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user