import com.owncloud.android.files.services.FileUploader;\r
import com.owncloud.android.ui.activity.FileDetailActivity;\r
import com.owncloud.android.ui.activity.FileDisplayActivity;\r
+import com.owncloud.android.utils.OwnCloudClientUtils;\r
import com.owncloud.android.utils.OwnCloudVersion;\r
\r
import com.owncloud.android.R;\r
final String WEBDAV_SCRIPT = "webdav.php";\r
final String WEBDAV_FILES_LOCATION = "/files/";\r
\r
- WebdavClient wc = new WebdavClient();\r
+ WebdavClient wc = OwnCloudClientUtils.createOwnCloudClient(account, getActivity().getApplicationContext());\r
HttpConnectionManagerParams params = new HttpConnectionManagerParams();\r
params.setMaxConnectionsPerHost(wc.getHostConfiguration(), 5);\r
\r
PropFindMethod find = new PropFindMethod(url+"/");\r
find.addRequestHeader("Referer", am.getUserData(account, AccountAuthenticator.KEY_OC_BASE_URL));\r
Log.d("sharer", ""+ url+"/");\r
- wc.setCredentials(account.name.substring(0, account.name.lastIndexOf('@')), am.getPassword(account));\r
\r
for (org.apache.commons.httpclient.Header a : find.getRequestHeaders()) {\r
Log.d("sharer-h", a.getName() + ":"+a.getValue());\r
}\r
\r
public void run() {\r
- WebdavClient wc = new WebdavClient(mAccount, getSherlockActivity().getApplicationContext());\r
- wc.allowSelfsignedCertificates();\r
+ WebdavClient wc = OwnCloudClientUtils.createOwnCloudClient(mAccount, getSherlockActivity().getApplicationContext());\r
AccountManager am = AccountManager.get(getSherlockActivity());\r
String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);\r
OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));\r
try {\r
int status = wc.executeMethod(move);\r
success = move.succeeded();\r
+ move.getResponseBodyAsString(); // exhaust response, although not interesting\r
Log.d(TAG, "Move returned status: " + status);\r
\r
} catch (HttpException e) {\r
\r
} catch (Exception e) {\r
Log.e(TAG, "Unexpected exception renaming file " + mOld.getRemotePath() + " to " + mNew.getRemotePath(), e);\r
- }\r
+ \r
+ } finally {\r
+ move.releaseConnection();\r
+ } \r
\r
if (success) {\r
FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver());\r
}\r
\r
public void run() {\r
- WebdavClient wc = new WebdavClient(mAccount, getSherlockActivity().getApplicationContext());\r
- wc.allowSelfsignedCertificates();\r
+ WebdavClient wc = OwnCloudClientUtils.createOwnCloudClient(mAccount, getSherlockActivity().getApplicationContext());\r
AccountManager am = AccountManager.get(getSherlockActivity());\r
String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);\r
OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));\r
try {\r
status = wc.executeMethod(delete);\r
success = (delete.succeeded());\r
+ delete.getResponseBodyAsString(); // exhaust the response, although not interesting\r
Log.d(TAG, "Delete: returned status " + status);\r
\r
} catch (HttpException e) {\r
\r
} catch (Exception e) {\r
Log.e(TAG, "Unexpected exception removing file " + mFileToRemove.getRemotePath(), e);\r
+ \r
+ } finally {\r
+ delete.releaseConnection();\r
}\r
\r
if (success) {\r