Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
nextcloud-android-lib
Commits
880099c8
Commit
880099c8
authored
Jul 13, 2020
by
Vincent Bourgmayer
🎼
Browse files
use UserAgent defined in the app
parent
00ced4ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
880099c8
# [/e/ NC/Dav Android Library](https://e.foundation/)
#
~~[Nextcloud](https://nextcloud.com) Android Library~~ [](https://drone.nextcloud.com/nextcloud/android-library) [](https://www.codacy.com/app/Nextcloud/android-library?utm_source=github.com&utm_medium=referral&utm_content=nextcloud/android-library&utm_campaign=Badge_Grade)
~~
[
Nextcloud
](
https://nextcloud.com
)
Android Library~~
[

](https://drone.nextcloud.com/nextcloud/android-library)
[

](https://www.codacy.com/app/Nextcloud/android-library?utm_source=github.com
&
utm_medium=referral
&
utm_content=nextcloud/android-library
&
utm_campaign=Badge_Grade)
## Introduction
Using Nextcloud Android library it will be the easiest way to communicate with Nextcloud servers.
...
...
src/com/owncloud/android/lib/common/OwnCloudClient.java
View file @
880099c8
...
...
@@ -204,19 +204,6 @@ public class OwnCloudClient extends HttpClient {
}
}
/**
* Requests the received method.
*
* Executes the method through the inherited HttpClient.executedMethod(method).
*
* @param method HTTP method request.
*/
@Override
public
int
executeMethod
(
HttpMethod
method
)
throws
IOException
{
return
executeMethod
(
method
,
mUseNextcloudUserAgent
?
OwnCloudClientManagerFactory
.
getNextcloudUserAgent
()
:
OwnCloudClientManagerFactory
.
getUserAgent
());
}
/**
* Requests the received method.
*
...
...
@@ -224,9 +211,8 @@ public class OwnCloudClient extends HttpClient {
* With the specified userAgent
*
* @param method HTTP method request.
* @param userAgent value of user agent parameters.
*/
public
int
executeMethod
(
HttpMethod
method
,
String
userAgent
)
throws
IOException
{
public
int
executeMethod
(
HttpMethod
method
)
throws
IOException
{
try
{
// Update User Agent
HttpParams
params
=
method
.
getParams
();
...
...
@@ -237,6 +223,7 @@ public class OwnCloudClient extends HttpClient {
} else {
userAgent = OwnCloudClientManagerFactory.getUserAgent();
}*/
String
userAgent
=
OwnCloudClientManagerFactory
.
getUserAgent
();
params
.
setParameter
(
HttpMethodParams
.
USER_AGENT
,
userAgent
);
Log_OC
.
d
(
TAG
+
" #"
+
mInstanceNumber
,
"REQUEST "
+
...
...
src/com/owncloud/android/lib/resources/files/CreateFolderRemoteOperation.java
View file @
880099c8
...
...
@@ -92,7 +92,7 @@ public class CreateFolderRemoteOperation extends RemoteOperation {
try
{
mkCol
=
new
MkColMethod
(
client
.
getWebdavUri
()
+
WebdavUtils
.
encodePath
(
mRemotePath
));
client
.
setUseNextcloudUserAgent
(
tru
e
);
client
.
setUseNextcloudUserAgent
(
fals
e
);
client
.
executeMethod
(
mkCol
,
READ_TIMEOUT
,
CONNECTION_TIMEOUT
);
if
(
HttpStatus
.
SC_METHOD_NOT_ALLOWED
==
mkCol
.
getStatusCode
())
{
...
...
src/com/owncloud/android/lib/resources/files/LightReadFolderRemoteOperation.java
View file @
880099c8
...
...
@@ -85,7 +85,7 @@ public class LightReadFolderRemoteOperation extends RemoteOperation {
protected
RemoteOperationResult
run
(
OwnCloudClient
client
)
{
RemoteOperationResult
result
=
null
;
PropFindMethod
propfind
=
null
;
String
userAgent
=
""
;
//
String userAgent ="";
try
{
// remote request
if
(
allowGzip
){
...
...
@@ -93,14 +93,14 @@ public class LightReadFolderRemoteOperation extends RemoteOperation {
WebdavUtils
.
getMinimumPropSet
(),
// PropFind Properties
this
.
depth
);
propfind
.
setRequestHeader
(
"Accept-Encoding"
,
"gzip"
);
userAgent
=
"gzipUserAgent"
;
//
userAgent = "gzipUserAgent";
}
else
{
propfind
=
new
PropFindMethod
(
client
.
getWebdavUri
()
+
WebdavUtils
.
encodePath
(
mRemotePath
),
WebdavUtils
.
getAllPropSet
(),
// PropFind Properties
this
.
depth
);
}
int
status
=
client
.
executeMethod
(
propfind
,
userAgent
);
int
status
=
client
.
executeMethod
(
propfind
/*
, userAgent
*/
);
// check and process response
boolean
isSuccess
=
(
status
==
HttpStatus
.
SC_MULTI_STATUS
||
status
==
HttpStatus
.
SC_OK
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment